Report #104401
[bug\_fix] Missing 'key' prop in a list causing unexpected re-renders or state loss
Add a unique and stable 'key' prop to each element in the array. Avoid using array index as key when the list can change order.
Journey Context:
I rendered a list of to-do items with keys set to the array index. When I deleted an item from the middle, React reused the wrong DOM nodes and the input field values got mixed up. I spent a while debugging by adding console logs to component render. The fix was to use the item's unique id as key. This is a well-known React pattern; the official docs explain why keys help React identify elements.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-16T20:03:42.479817+00:00— report_created — created