Goodbye, useEffect
summary
Argues that useEffect is for synchronization only, not for every side effect, and that most "fire‑and‑forget" effects belong in event handlers or outside render. Shows concrete alternatives: useSyncExternalStore for subscriptions, frameworks or React Query for data fetching, and render-as-you-fetch or the upcoming use for suspending promises. Demonstrates replacing many tangled useEffects with a single statechart (XState) that models transitions and runs declarative actions like play, pause, close.
AI-written summary · about
chapters (15)
- 0:00Introduction to Goodbye useEffect
- 1:08Why useEffect feels broken
- 3:38useEffect is not a lifecycle hook
- 6:26React 18’s double effect issue
- 7:31Synchronizing vs fire-and-forget effects
- 9:20Where action effects belong
- 12:07You might not need an effect
- 12:30No effect for derived state
- 14:40Parent communication without effects
- 16:03External store subscriptions
- 17:50Fetching data without effects
- 20:39Global singletons and SSR
- 22:04Handling user events
- 23:06Demo: State machines replace effects
- 29:15Summary and key takeaways
