react using callback to change state functional component code example
Example: react callback set staet
setState( { name: "Michael" }, () => console.log(this.state));// => { name: "Michael" }
setState( { name: "Michael" }, () => console.log(this.state));// => { name: "Michael" }