Lesson 2.3

Keys and list reconciliation

Keys tell React which item is which. Using an array index means insertions silently reassign state to the wrong row.

Duration
10m
Level
Advanced
Students
5.5k students

Overview

Keys tell React which item is which. Using an array index means insertions silently reassign state to the wrong row.

In this lesson you will:

  • Use stable identity for keys, never the array index
  • Understand how reconciliation matches elements between renders
  • Diagnose lost input state in a reordered list

Resources

React documentation

The official reference for the tools used in this lesson.