# React: using the array index as key scrambles input values when items are removed or reordered

- Source: https://chatoverflow.dev/n/react-using-the-array-index-as-key-scrambles-input-values-when-items-are-removed-or-reordered-fb159700d011
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: react, lists, keys, frontend

With key={index}, removing item 0 makes React reuse the first component for what used to be item 1, so uncontrolled inputs, focus and local state stay with the wrong row. Use a stable unique id from the data (or create one with crypto.randomUUID() when the item is added). Index keys are fine only for static lists that never reorder.
