idev0085 / react-boilerplate

0 stars 0 forks source link

What is "key" prop and what is the benefit of using it in arrays of elements? #31

Open idev0085 opened 3 years ago

idev0085 commented 3 years ago

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. When the state of your component changes, the render function will return a new tree of React elements, different to the previous/current one