updated the state using call back 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" }