
React Useeffect
This is basically the React docs distilled into a decision tree for when you actually need useEffect versus when you're reaching for it out of habit. It covers the common antipatterns like using Effects for derived state or event handling, then shows you what to use instead: direct calculations, useMemo for expensive ops, key prop for resets, and plain event handlers. The quick reference table is especially useful during code review when you spot someone setting state in an Effect that should just be computed during render. Honestly, most useEffect bugs come from using it when you don't need an external system at all.
- skills.sh installs
- 454
- GitHub stars
- 33.2K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add davila7/claude-code-templates --skill react-useeffect --agent claude-codeInstalls into .claude/skills of the current project.
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
| Situation | DON'T | DO |
|---|---|---|
| Derived state from props/state | useState + useEffect | Calculate during render |
| Expensive calculations | useEffect to cache | useMemo |
| Reset state on prop change | useEffect with setState | key prop |
| User event responses | useEffect watching state | Event handler directly |
| Notify parent of changes | useEffect calling onChange | Call in event handler |
| Fetch data | useEffect without cleanup | useEffect with cleanup OR framework |
When You DO Need Effects
- Synchronizing with external systems (non-React widgets, browser APIs)
- Subscriptions to external stores (use
useSyncExternalStorewhen 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
Sponsors
Details
- Repository
- github.com/davila7/claude-code-templates
- Categories
- Frontend Development, Documentation
- First seen
- Jun 3, 2026
More from davila7/claude-code-templates
All 618- Backend Patterns452
- Find Bugs447
- Langgraph447
- Agent Md Refactor446
- Autonomous Agent Patterns446
- D3 Viz445
- Manim444
- Marketing Psychology443
- Requirements Clarity442
- Frontend To Backend Requirements441
- Canvas Design439
- Nowait Reasoning Optimizer438
- Code Review Checklist437
- Prompt Caching437
- Commit435
- Vercel Deployment433
- C4 Architecture430
- Information Security Manager Iso27001428
- Mlflow427
- Statsmodels426
- Prompt Library423
- Chroma421
- Telegram Mini App420
- Pricing Strategy419