Two places I see useEffect overuse today: 1


Two places I see useEffect overuse today:

1. Fetching via HTTP.

Solution? Use react-query, React Router loader, or fetch on the server if in Next, or Remix.

2. Syncing state.

Solution? Update state in event handlers. Or, derive state on render and memo if expensive.

#react
Here's how to replace a useEffect by deriving state on render.

View original on X