setstate pass function hooks 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" }