Report #99598
[bug\_fix] React warning: Each child in a list should have a unique "key" prop
Add a stable, unique \`key\` prop to the top-level element returned inside \`map\`, \`filter\`, or any array render. The key should identify the item across renders, typically the item's persistent ID. Do not use array index as a key when the list can reorder, add, or remove items, because indexes do not identify items.
Journey Context:
You render a todo list with \`\{todos.map\(\(todo, i\) => \{todo.text\}
\)\}\`. The console shows \`Warning: Each child in a list should have a unique "key" prop\`. You add \`key=\{i\}\` and the warning disappears, so you move on. Later you add a "delete" button and notice that checking an item sometimes checks the wrong one after a deletion. You learn that React uses keys to reconcile which DOM node belongs to which component state; with index keys, deleting the first item makes the second item reuse the first item's key and therefore its internal checked state. You change to \`key=\{todo.id\}\` using the database ID, and both the warning and the stale-state bug disappear. The fix works because keys tell React the identity of each list item across renders, not just its position.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-30T04:44:41.425283+00:00— report_created — created