DEV Community

Cover image for React: Efficiently Rendering Lists

React: Efficiently Rendering Lists

Ryan Moragas on December 08, 2019

React JS, which was created by Facebook, is today's most popular JavaScript Library for building User Interfaces. We can use React to build sleek, ...
Collapse
 
daveskull81 profile image
dAVE Inden

Great post. I feel like it is so easy to give the index of an item as the key for a list that many people do it just to get the error to go away in their console. I see lots of tutorials suggest this too since they aren’t covering the key property specifically. But, this could be a serious performance issue in a big application. I really like this article on the key prop by Kent C. Dodd. It goes over similar issues to what you’ve shown here.

Collapse
 
fly profile image
joon

Definitely something that I probably overlooked in the past. Thanks for the heads up!

Collapse
 
svish profile image
Torleif Berger

You should always try to use a unique ID key that no other item on your page will have.

Is that really necessary? Thought it only has to be unique within the array you're rendering?