I cannot wrap my head around the issue below.
The issue relates to the asynchronous setState dimension. Usually I use the callback, but doesn\'t seem appropriate here.
Just use second argument in this.setState.
Second argument is a function that will be called after seting State.
this.setState({ name:value },() => {this.nameOfTheFunctionYouWantToRunNext() });