Skip to content
Justice Tech School

Lists and Keys

map builds lists. Each item needs a stable key.

Example
function Names({ names }) {
  return (
    <ul>
      {names.map((n) => (
        <li key={n.id}>{n.name}</li>
      ))}
    </ul>
  );
}

Exercise

Required list attribute.

<li ={n.id}>

Quiz Test

What makes a good key?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.