⚛️ React code smell: Multiple setState calls in a row


⚛️ React code smell: Multiple setState calls in a row.

This is often a sign that state should be unified, or that one value value can be derived from another.

Potential fixes:
Unify into one useState call via an object
Consider useReducer
Derive state (shown below)

#react

View original on X