map is not rendering the ui elements in reactjs

后端 未结 2 1905
伪装坚强ぢ
伪装坚强ぢ 2020-12-04 03:40

What would be the best way to render out the todos object when that object is updated? I\'ve tried mapping through it, but it returns nothing with errors.

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 03:41

    If you want the arrow function to return a value use () instead of {}

    {this.state.todos.map((td, index) => (
        
  • {td.name}
    {td.date}
  • ))

提交回复
热议问题