Skip to content
Discussion options

You must be logged in to vote
{items.map((item, index) => {
  console.log(item.description);
  <li key={index}>{item.description}</li>
})}

should be:

{items.map((item, index) => {
  console.log(item.description);
  return <li key={index}>{item.description}</li>
})}

alternatively you could replace the braces with parenthesis and then you could do it like this (which is an implicit return of you <li>...):

{items.map((item, index) => (
  <li key={index}>{item.description}</li>
))}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@darrylmorley
Comment options

Answer selected by darrylmorley
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants