0

Can I use setstate inside the callback function of the setstate '''this.setstate(update,function(){this.setstate}.bind)''' is the above given code correct and will it work

1 Answers1

0
this.setState({
 someState: newValue,
}, callback);

above code is using callback function in setState.

so you may write code like this.

this.setState({
 someState: newValue,
}, () => {
 // some code you want
});
gnujoow
  • 374
  • 1
  • 3
  • 16