Report #60795
[bug\_fix] Warning: Each child in a list should have a unique 'key' prop. OR State corruption when list reorders \(stale state in wrong items\).
Add a stable, unique key prop to the top-level element inside the map function, using item.id or similar. Never use array index as key if the list can reorder or items can be inserted/deleted.
Journey Context:
Developer renders a list: \{items.map\(\(item, index\) => \{item.name\}
\)\}. React warns about missing key prop. Developer adds index as key: key=\{index\}. Warning disappears. Later, they add input fields to each row controlled by React state. When they reorder the list or delete an item, the state \(input values\) gets stuck to the wrong visual row or causes unexpected behavior. Developer realizes that using index as key causes React to reuse component instances when the order changes, confusing the reconciliation algorithm. The fix is to use a unique stable identifier from the data: key=\{item.id\}. If no ID exists, they must generate one or use a library like uuid, but never the index for dynamic lists.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T08:31:49.997536+00:00— report_created — created