Rendering Lists
Use .map() to loop through arrays and return components. Each item needs a unique key prop.
jsx
<ul> {users.map(user => ( <li key={user.id}>{user.name}</li> ))} </ul>Keys help React identify which items changed.
React JS 0 to Hero: The Complete Guide
Use .map() to loop through arrays and return components. Each item needs a unique key prop.
jsx
<ul> {users.map(user => ( <li key={user.id}>{user.name}</li> ))} </ul>Keys help React identify which items changed.