New advertisers: 50% off your first month with code FIRSTMONTHSee slots

React useEffect guidance that steers away from unneeded Effects toward render-time calculation, event handlers, and key props.

skills.sh installs
4.2K
GitHub stars
2.7K
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers when Effects are an escape hatch, and when derived state, user events, or prop resets need no Effect at all
  • Includes a quick-reference table mapping common DON'T patterns to DO alternatives, plus a decision tree for choosing a response method
  • Enforces the rule that Effects are reserved for synchronizing with external systems, subscriptions, analytics, and cleanup-safe data fetching
  • Designed for React developers writing or reviewing components, with linked deep dives on anti-patterns and alternatives like useMemo and useSyncExternalStore

Install

$ npx -y skills add softaworks/agent-toolkit --skill react-useeffect -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

You Might Not Need an Effect

Effects are an escape hatch from React. They let you synchronize with external systems. If there is no external system involved, you shouldn't need an Effect.

Quick Reference

SituationDON'TDO
Derived state from props/stateuseState + useEffectCalculate during render
Expensive calculationsuseEffect to cacheuseMemo
Reset state on prop changeuseEffect with setStatekey prop
User event responsesuseEffect watching stateEvent handler directly
Notify parent of changesuseEffect calling onChangeCall in event handler
Fetch datauseEffect without cleanupuseEffect with cleanup OR framework

When You DO Need Effects

  • Synchronizing with external systems (non-React widgets, browser APIs)
  • Subscriptions to external stores (use useSyncExternalStore when possible)
  • Analytics/logging that runs because component displayed
  • Data fetching with proper cleanup (or use framework's built-in mechanism)

When You DON'T Need Effects

Details

Repository
github.com/softaworks/agent-toolkit
Category
Frontend & UI Code

More from softaworks/agent-toolkit

All 40

Similar to React Useeffect

More Frontend & UI Code