List Key Best Practice
Multiple Choice Easy
Question
What is the best value to use as a `key` prop in a list?
Hint
Keys must be stable across re-renders and unique among siblings.
Explanation
The best key is a stable, unique ID from your data (like a database ID). Array indices should be avoided for dynamic lists because they cause bugs when items are reordered, inserted, or deleted. Keys must be stable and unique among siblings.
Related Resources
Related Lessons
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.