SpinTheMic
Pro

Interview practice question

"Each child in a list should have a unique key" warning

Frontend Engineering · React · Beginner

React warns that each child in a list should have a unique "key" prop. How do you fix it properly?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Add key to the outermost element in map.
  • Use stable unique ID from data.
  • Avoid index if list changes.
  • Generate IDs when data is created, not during render.
  • Keys unique among siblings only.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics