I searched a lot before asking but can't seem to find a solution that works with me.
I have a function that I need to be called after the state is set to the new value.
const onClickCallback = () => {
setState(..., setCallback())
}
const setCallback = () => {
console.log(State) // this prints the old State value
if(State === something){
....
}
}
Eventhough the function is being called as the setState callback, it still gets the older value.
I'm not sure if the problem is from my end or it's just not possible..