I am getting an error
that.setState is not a function
I saw the questions React this.setState is not a function
Still I cannot get it to work.
But mine is an independent function. Also I store the context and use it like :
componentDidMount(){
that=this;
}
and then
updateResult(item){
result.push(item);
that.setState({result: result});
}
I also bind it in the constructor
this.updateResult = this.updateResult.bind(this);
this.resetResult = this.resetResult.bind(this);
I also tried doing on one function
onUpdate(item, ()=>{
itemList.push(item);
that.setState({itemList: itemList});
}.bind(this));
but gives an UnexpectedToken Error!
I do pass it like this
<Buttons onUpdate={this.onUpdate} />
and then call the function from there, but I am using 'that' for setState.
This is my first application, sorry if there are very obvious mistakes!