I have an array of values in state as
constructor {
super(props);
this.state = {
staff: {
pos1: { name:'Ajith'}
pos2: { name:'Ben'}
}
}
}
componentDidMount() {
this.state.staff.map((item,index) => {
console.log(item+" * "+index)
}
}
I got an error this.state.staff.map is not a function as the index is not as 0, 1 etc. How can I fix this?