React & Next.js errors · Error 03 of 7
“Each child in a list should have a unique key prop”
By Muhammad Abdullah, full-stack, mobile and ai automation developer · Last reviewed
Each child in a list should have a unique "key" prop.Short answer
Items rendered with .map() need a stable, unique key so React can track them. Use an id from your data; avoid array indexes when items can be added, removed or reordered.
Common causes
- Missing
keyon the element returned from.map(). - Keys that repeat, such as names or titles.
How to fix it
Use a stable id on the outermost element of each item:
{users.map((user) => ( <UserRow key={user.id} user={user} /> ))}