React tip: Avoid using useEffect to sync state


React tip: Avoid using useEffect to sync state.

Instead:
1. Derive values on render
2. Handle logic in events

I just eliminated these 3 useEffect calls that were being used to sync state. Instead, I'm calculating these values in the submit handler.

Less buggy, and simpler.

View original on X