Back to course

Lists and Keys

React JS 0 to Hero: The Complete Guide

Rendering Lists

Use .map() to loop through arrays and return components. Each item needs a unique key prop.

jsx

    {users.map(user => (
  • {user.name}
  • ))}

Keys help React identify which items changed.