score:1

Accepted answer

data is an object rather than an array so calling map on it triggers an error.

simply do this.state.data.segments.map(...) instead, and change your initial state to

state = { data: { segments: [] } }

score:0

map is a function of array. the data is an object while data.segments is an array. you will need to change the code as below

 <div classname="clientcontainer">
  {
     this.state.data.segments.map( item =>( //change here
     <div>
        <span> {item.clientname} </span>
     </div>
  ))
  }
  </div> 

Related Query

More Query from same tag