idev0085 / react-boilerplate

0 stars 0 forks source link

What is the impact of indexes as keys? #71

Open idev0085 opened 3 years ago

idev0085 commented 3 years ago

If the key is an index, reordering an item changes it. Hence, the component state can get mixed up and may use the old key for a different component instance. Without a unique key, React can't differentiate if the element was removed or just the content is changed.