
https://reactjs.org/docs/lists-and-keys.html
Lists and Keys – React
A JavaScript library for building user interfaces
reactjs.org
“key” is a special string attribute you need to include when when creating lists of elements.
Keys help React identify which items have changed, are added, or are removed.
Keys should be given to the elements inside the array to give the elements a stable identity
Key는 특별한 문자열 속성으로 컴포넌트등 요소를 목록으로 생성할때 반드시 포함해야 하는 것이다.
키는 리액트가 각 요소들이 변했다는 것을 파악하고 구분할 수 있도록 하는 역할을 한다.
키는 컴포넌트 요소들의 목록에 포함된 각 요소들에 주어져야 하고, 이는 각 요소들에게 안정적인 구분을 부여한다.
===============
위처럼 각 요소를 구분하기 위해서라는 의미에서 고유하다는 것으로 반드시 사용하라는 설명서를 따르는 개념입니다.
https://youtu.be/QC3PtSlzp3s
https://youtu.be/ghxHAy3LH28
'개발일지' 카테고리의 다른 글
onAnimatedValueUpdate 경고 (0) | 2023.01.20 |
---|---|
3-11 오류 (0) | 2023.01.17 |
AboutPage (0) | 2023.01.07 |
삼항 연산자 (0) | 2023.01.07 |
map 함수로 반복문 돌리기 (0) | 2023.01.07 |