SetState Before Function React
this.setState(
{newState: 'whatever'},
() => {/*do something after the state has been updated*/}
)
Xenophobic Xenomorph
this.setState(
{newState: 'whatever'},
() => {/*do something after the state has been updated*/}
)