loading...

re: Opinionated React - Use Status Enums Instead of Booleans VIEW POST

FULL DISCUSSION
 

Since these are mutually dependent state items, I'd use useReducer.

Or to make the code much cleaner, move all this into a separate hook that uses useReducer internally.

 

I agree! I mentioned in the post that I normally wound't use three separate useState calls - just wanted to illustrate the concept easily.

I do something similar to what you're mentioning - which you can read about here if you're interested 👍

dev.to/farazamiruddin/opinionated-...

code of conduct - report abuse