Question · Vibe coding with Claude Code course · Module 12: Medium clone
A list item key
The list of articles changes order after switching to the Top tab. What key do you give the list items?
Answer options
- key={article.id}, because the identifier from the data belongs to the article regardless of its position in the list
- key={i}, because an array index is always unique
- key={Math.random()}, because a random number guarantees uniqueness
- None, because React will pick keys itself without warnings
You can check the correct answer by solving this task in the CodeWorlds game.