1
I created a button that receives a value, by clicking on it the value is stored in the state, soon after I try to get that state value but empty lap, the interesting thing is that in the second click on the button it returns the value of the first click.
The value of target does not serve, because I need to play the pro state value so that another function can be executed in sequence.
How do I fix it?
eventToState = event => {
this.setState({ buttonValue: event.target.value });
console.log("teste", this.state.buttonValue);
};
// SAÍDA
// teste ""
// teste I'm the value of button element
Entire code https://codesandbox.io/s/state-8fj2x
@Augustovasques Sorry, it’s a friend of mine ^^
– gleisin-dev
@Augustovasques quiet, you did not know, and incidentally here is not a "personal social network" so it was worth the tip yes!
– gleisin-dev