Is there a better way to handle doing something after updating the state with #react `useState`?

Having a useEffect just feels a bit clunky especially when I have multiple states that I need to watch and do something whenever they're updated

Also on that, if useState is asynchronous, why doesn't it return a promise? I'm assuming there's a reason for that

#reactjs #javascript #webdev

@ta1da The canonical solution is some kind of state management on top of React, like Redux, which maintains its own global state against which you can fire actions and side-effects.

If you're not looking to add project-wide state management, a glom of useEffect's is your best bet really.

@Two9A that's mildly annoying, but I definitely won't be adding Redux just to deal with that.
@ta1da @Two9A take a glance at Zustand. So much easier than Redux.
@sysrage @Two9A I've been meaning to but just hadn't had the chance to use it! This might be the perfect opportunity