I pushed an element to an array in a function( event), after pushing this element to the array I am getting this error,
handleAddList(s) {
this.setState({lists :this.state.lists.push(s) });
console.log(this.state.lists);
}
lists.map is not a function. list a react component
if I write it as this
handleAddList(s) {
this.setState({lists :['something','something else']});
console.log(this.state.lists);
}
But when I define lists manually it works well. Just when I push a new element in the array I get this error. Also if push destroys the array. Best regards