Skip to content

Laboratory · React Lab

Reconciliation investigation

Briefing

Why does using an array index as a key cause state to attach to the wrong item, while a stable id does not?

Delete the first row of a list and the wrong checkbox stays ticked. The list is correct. The keys are not.

Laboratory
React Lab
Level
ENGINEER
Estimated time
9 minutes
Method
interactive
Variables under observation
reconciliationkeyscomponent identitystate preservation