The discussion is here.
In my code i did like this to get the proper result of the state
setMyName(myName, f) {
this.setState({myName}, () => {
f()
});
}
...
handleImgClick = (e) => {
this.setMyName('Stanley', () => {alert(this.state.myName)});
}