here's my state:
state={show: false,addDisplay:true,key:'',sections: [{title:'primary',
data:['a','b']
}]
}
and here I'm trying to setState:
this.setState({...this.state,sections: [{title:'primary',
data: [...this.state.sections.data,this.state.input]
}]
})
why is this.state.sections.data undefined?
this.state.sectionsis an array, you aren't accessing it like it's an array