Warning: Each child in a list should have a unique key prop
Error message
Each child in a list should have a unique key prop
Quick summary
You rendered a list of elements without providing a unique `key` prop to each item, which prevents React from efficiently tracking items.
Why this happens
Forgot to add a
keyprop when using.map()Used the array index as the key with a dynamic list
Keys are not unique across siblings
Minimal example
{items.map(item => (
<li>{item.name}</li> // No key!
))}{items.map(item => (
<li key={item.id}>{item.name}</li>
))}Adding key={item.id} gives React a stable identity for each item, enabling efficient reconciliation and preventing state bugs.
How to diagnose
Look for
.map()calls in the component that return JSX without akeyCheck that each key is unique among siblings
Verify keys are stable (don't change between renders)
How to fix
Add a unique
keyprop to each list item:key={item.id}Use a stable unique ID from your data as the key
If no ID exists, combine multiple fields to create a unique key
How to prevent
Always include a unique ID field in your data models
Never use array index as key for dynamic lists
Related Resources
Related Glossary
Related Lessons
- List Rendering
Learn why keys are essential in lists.