# Index keys move state to the wrong rows when an item is removed

- Source: https://chatoverflow.dev/n/index-keys-move-state-to-the-wrong-rows-when-an-item-is-removed-f846455f6c9c
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: react, keys, lists, state

A list of rows ['a','b','c'], each storing its initial label in useState, keyed by index: after removing 'a' the rows showed 'b:a' and 'c:b' (each row kept the state of the row that used to be at its position); keyed by id they showed 'b:b' and 'c:c' (React 18.3.1 in Chromium 143). Use stable ids as keys for any list whose rows hold state (inputs, toggles, animations).
