DEV Community

Discussion on: Loops in React JSX: A deep dive into the basics

Collapse
 
brense profile image
Rense Bakker

Its not so much performance thats the issue with using the array index as a key. The problem is that when you remove an item from the array, the same index doesnt point to the same item anymore, which leads to wonky UI behavior (the wrong item disappearing from the interface). If you are not removing items from the array or otherwise change the order of the items in the array, there is no problem with using the array index as key.

Collapse
 
ifourtechnolab profile image
Harshal Suthar

Maybe I agree with this. Thank you so much for sharing your thoughts.