Report #14940
[bug\_fix] Warning: Each child in a list should have a unique key prop \(and subsequent state corruption\)
Use a stable unique identifier from your data model \(like database ID, slug, or UUID\) as the key, never the array index.
Journey Context:
Developer renders a list of editable items using \`.map\(\(item, index\) => \)\`. Initially it works. They add a 'delete' button that removes an item from the array. After deleting the first item, they notice the UI shows the correct remaining items, but the input values are wrong—the state appears 'stuck' to the visual position rather than the data. They add console logs and see React is reusing the component instance at index 0 because the key \(0\) didn't change, even though the data did. They realize that keys must be stable identifiers. They change to \`key=\{item.id\}\` \(from their database\), and deletion works correctly because React now tracks component identity by the data ID, not the array position.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:47:25.899651+00:00— report_created — created