Reiterating properties in state

How do I implement the render function for below state without giving error/warning.

this.state = {
  timingList: [
    {
      id: 1,
      time: '9 AM',
      isMeetingSet: false
    },
    {
      id: 2,
      time: '10 AM',
      isMeetingSet: false
    },
    {
      id: 3,
      time: '11 AM',
      isMeetingSet: false
    }
  ]
}

I am using the ForEach, but does not seem to work.

 render() {
    return (
        <div className="main-container">
            <div className="timing-list-container">
                {
                    this.state.timingList.forEach(timing => {
                        return <div>
                            <span key={timing.id}>{timing.time}</span>
                        </div>
                    })
                }
            </div>
        </div>
    );
}

Use map instead of forEach.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.