dont-use-use-effect

Identify and correct unnecessary useEffect usage in React components.

2|Updated Feb 23, 2026
One-click install
npx skills add https://github.com/jonmumm/skills --skill dont-use-use-effect-jonmumm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dont-use-use-effect
Source: https://github.com/jonmumm/skills/tree/main/dont-use-use-effect
Command: npx skills add https://github.com/jonmumm/skills --skill dont-use-use-effect-jonmumm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Avoid unnecessary useEffect in React components, helping you prevent extra renders, stale closures, race conditions, and harder-to-reason-about code.

The golden rule: Effects are for synchronizing with external systems (DOM APIs, timers, websockets, third-party widgets). If the work you're doing is a response to a user event, or can be calculated from existing state/props, you don't need an Effect.

Core Features & Use Cases

  • Derive state during render to avoid unnecessary state and effects.
  • Move event-driven logic into explicit event handlers.
  • Consolidate effect chains or replace with derived values where possible.
  • Prefer data-fetching libraries (TanStack Query, SWR) over raw useEffect for data loading.
  • Use useSyncExternalStore for external subscriptions when possible.

Quick Start

Refactor React components to minimize useEffect by deriving state in render, moving event-driven logic to handlers, and using data-fetching libraries.

Frequently Asked Questions about dont-use-use-effect

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I avoid unnecessary useEffect in React components?

To avoid unnecessary useEffect in React components, derive state during render, move event-driven logic to explicit handlers, and use data-fetching libraries instead of effect-based data loading.

When should I not use useEffect in React?

You should not use useEffect when responding to user events or calculating values from existing state and props. useEffect is specifically for synchronizing with external systems like DOM APIs, timers, and websockets.

What is the best way to fetch data in React without useEffect?

The best way to fetch data without useEffect is using dedicated data-fetching libraries like TanStack Query or SWR, which prevent race conditions and stale closures better than raw effect-based data loading.

How do I derive state during render instead of using useEffect?

Derive state during render by calculating values directly from existing state and props. This eliminates unnecessary state variables and effects, preventing extra renders and harder-to-reason-about code.

How do I handle external subscriptions in React without useEffect?

Handle external subscriptions in React by using the useSyncExternalStore hook. This provides a more reliable way to subscribe to external systems than managing subscriptions manually inside useEffect.

Why does my React component have extra renders and stale closures?

Extra renders and stale closures often happen when using useEffect for state derivation or event-driven logic. Refactoring to derive state in render and moving logic to event handlers resolves this.