react-useeffect

React useEffect best practices from official docs. Use when writing/reviewing useEffect, useState for derived values, data fetching, or state synchronization.…

INSTALLATION
npx skills add https://github.com/davila7/claude-code-templates --skill react-useeffect
Run in your project or agent environment. Adjust flags if your CLI version differs.

SKILL.md

$2b

  • 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

  • Transforming data for rendering - Calculate at top level, re-runs automatically
  • Handling user events - Use event handlers, you know exactly what happened
  • Deriving state - Just compute it: const fullName = firstName + ' ' + lastName
  • Chaining state updates - Calculate all next state in the event handler

Decision Tree

Need to respond to something?

├── User interaction (click, submit, drag)?

│   └── Use EVENT HANDLER

├── Component appeared on screen?

│   └── Use EFFECT (external sync, analytics)

├── Props/state changed and need derived value?

│   └── CALCULATE DURING RENDER

│       └── Expensive? Use useMemo

└── Need to reset state when prop changes?

    └── Use KEY PROP on component

Detailed Guidance

BrowserAct

Let your agent run on any real-world website

Bypass CAPTCHA & anti-bot for free. Start local, scale to cloud.

Explore BrowserAct Skills →

Stop writing automation&scrapers

Install the CLI. Run your first Skill in 30 seconds. Scale when you're ready.

Start free
free · no credit card