Report #13079
[bug\_fix] Warning: Each child in a list should have a unique "key" prop. Check the render method of \`List\`.
Use a stable unique identifier from your data \(e.g., item.id, item.uuid\) as the key prop instead of the array index. Only use index as key if the list is static \(never reordered, filtered, or items added/removed from middle\).
Journey Context:
Developer renders a dynamic list: \`items.map\(\(item, index\) => \{item.name\}
\)\`. Initially displays fine. Later, they add a "Delete" button that removes an item from the middle of the array. After deletion, the UI shows the wrong item removed \(the last item disappears visually, but the data shows a middle item was removed\), or input fields inside list items retain values belonging to the deleted item. Developer checks the state array—it's correct. They inspect the DOM and see that React is reusing DOM nodes incorrectly. They recall that React uses keys to identify elements across renders. Using array index as key means when item at index 2 is deleted, item at index 3 becomes index 2; React sees the same key \(2\) and assumes it's the same component, preserving its state/DOM. The fix is to use the item's unique ID \(from database or UUID\) as key, so React correctly identifies which specific item was removed and unmounts its component entirely, preventing state leakage.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T17:44:18.962316+00:00— report_created — created