React Bug Hunt Easy +10 XP
Missing Key Prop
This list renders but causes a console warning.
ReactFind the bug
1
items.map(item => <li>{item.name}</li>) The bug is on line 1
Select the correct fix
Show answer and explanation
Answer: Add key={item.id} to <li>
React requires a unique 'key' prop on list elements to efficiently re-render when the list changes.
Hint: React needs a unique identifier for list items.
What this challenge tests
Bug Hunt in React: lists, keys.