react native
21.12.28 Encountered two children with the same key, '0'.
슈팅스타제제
2021. 12. 28. 10:36
Encountered two children with the same key, '0'.
Keys should be unique so that components maintain their identity across updates.
Non-unique keys may cause children to be duplicated and/or omitted - the behavior is unsupported and could change in a future version.
원인: 배열의 map을 돌릴 때 key로 배열을 구분해주는데 이때 똑같은 배열을 돌리면서 같은 값을 key로 사용하면 발생하는 경고이다.
해결: 배열의 값 중 unique한 다른 값을 key로 사용하면 없앨 수 있는 경고!