Solving ‘Each Child Should Have a Unique Key’ Warning in React

Minah Mmassy - Feb 14 - - Dev Community

As a developer, I’ve faced the ‘Each Child Should Have a Unique Key’ warning in React.

Warning: Each child in a list should have a unique "key" prop.

It is so annoying. It is a very typical warning in React and will slow down your app.

Why React Needs Unique Keys
React uses keys to identify which items have changed, been added, or removed. Without keys, React cannot determine which list items to update. If each list item has a unique key, React can re-render just the changed items rather than re-rendering the whole list. Here are the two errors that developers are making Link

. . . .