A correct way to log the current state after the update would be:


PHOTO EMBED

Thu Oct 15 2020 07:52:45 GMT+0000 (UTC)

Saved by @papiproud #react.js #setstate

this.setState({ name: 'Matt' }, () => console.log(this.state.name))
content_copyCOPY

https://dev.to/thawkin3/3-react-mistakes-junior-developers-make-with-component-state-1bhd?utm_source