-1

I am trying to map over a really simple array in react, but always receiving

Expected an assignment or function call and instead saw an expression  no-unused-expressions

this is the code

render() {
  const arr = [1, 2, 3, 4, 5];
  return (
    <div>
      <ul>
        <li>{this.state.amount}</li>
        {arr.map((e) => {
          <li key={e}>
            {e}
          </li>
        })}
      </ul>
    </div>
  );
}

For me everything looks like in all the tutorials and examples like https://reactjs.org/docs/lists-and-keys.html

FuzzyTemper
  • 723
  • 4
  • 10
  • 24
  • you forgot the return in map callback function, that's why getting the error. write it like this: `{arr.map((e) => (
  • {e}
  • ))}` or add return: `{arr.map((e) => { return
  • {e}
  • })}` – Mayank Shukla Apr 09 '19 at 05:18