React · Junior · Question 69 of 75

Why does this list render nothing?

{users.map((u) => {
  <li key={u.id}>{u.name}</li>;
})}

Explanation

Use parentheses for an implicit return: users.map((u) => (<li ...>)), or write return inside the braces.

Further reading

Problem with a question

React · Junior · question 69

Test yourself

Take the React · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz