React: getting started

Lesson 03 · 12 min

Lists, keys and effects

An array in JSX is `.map`. A key isn't the index if the list moves. An effect isn't for calculations.

12 minLesson 3 of 8Practice includedAsk AI on any point

A list is drawn like this: items.map((item) => <li key={item.id}>{item.title}</li>). key tells React which row is which when the array shifts. An index as key breaks when inserting into the middle: input fields "move" to other rows.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.