score:0

one way to handle this would be with the help of useeffect, which is a built-in react hook that activates a callback when one of it's dependencies have changed.

example:

useeffect(() => {
   setstateuserinfo(data.data);
   // whatever else we want to do after the state has been updated.
}, [statetoken])

this will "watch" the value of statetoken and run the callback every time it changes.
hence, whenever statetoken gets updated, so does stateuserinfo.

check the documentation for more info.


Related Query

More Query from same tag