WeCodeAcademy

Lists and Keys

Turn an array into elements with .map(). Give every item a stable, unique key so React can track it between renders.

Examplereact
Open in editor »

Use an id from your data as the key, not the array index when items can be reordered or removed. Notice filter creates a new array: never modify state arrays in place.

Quick check

What is the `key` prop for?

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.