4 ms·
> I found myself just the other day wishing i could await the setting of a state variable, it was making saving a file in a complicated form a little difficult.
by bluefirebrand 3y ago
> I found myself just the other day wishing i could await the setting of a state variable, it was making saving a file in a complicated form a little difficult.
It used to be that React.setState would accept a callback function to fire after the state was set.
The newer setter function returned by useState doesn't have that anymore I'm pretty sure. Tbh I've never tried though.