What's your use case?
If you are using useEffect to deal with state side-effect the useEffect hook will only be called after the state has updated in a synchronous manner.
If let's say you you defining a useCallback function to change state, you are at the same scope of the setState which means you have direct access to new value as well.

https://gist.github.com/AndreiCalazans/929e4d879719f707ea4f5208f5fd86f9

--

Software Engineer - Head Of Vetting At G2i

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrei Calazans

Andrei Calazans

Software Engineer - Head Of Vetting At G2i