react-useeffect-avoid

Identify React useEffect anti-patterns and recommend render-time alternatives.

Updated Apr 29, 2026
One-click install
npx skills add https://github.com/dev-khoi/conHack-2026 --skill react-useeffect-avoid-dev-khoi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-useeffect-avoid
Source: https://github.com/dev-khoi/conHack-2026/tree/main/.opencode/skills/react-useeffect-avoid
Command: npx skills add https://github.com/dev-khoi/conHack-2026 --skill react-useeffect-avoid-dev-khoi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guides developers on when not to use useEffect and how to apply better alternatives to improve performance and predictability in React apps.

Core Features & Use Cases

  • Identifies common anti-patterns like deriving state in useEffect, stale resets on prop changes, and cascading effect triggers.
  • Presents actionable alternatives such as render-time derived state, event handlers, and selective subscriptions to external data sources.
  • Provides a decision-tree approach and quick-reference guidance to streamline code reviews and debugging.

Quick Start

Review a React component to spot unnecessary useEffect usage and replace it with direct render-time calculations or appropriate handlers.

Frequently Asked Questions about react-useeffect-avoid

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

FAQPage Schema
When should I avoid using useEffect in React?

You should avoid useEffect for deriving state, resetting variables on prop changes, or cascading triggers. Apply render-time calculations, direct event handlers, or specialized hooks to improve React performance and predictability.

How do I replace useEffect for derived state in React?

Replace useEffect for derived state by calculating values directly during render-time. This approach eliminates unnecessary effect cycles, stale resets, and improves overall component performance.

What are common React useEffect anti-patterns?

Common useEffect anti-patterns include deriving state inside effects, stale resets on prop changes, and cascading effect triggers. Identifying these patterns during code reviews helps streamline debugging and maintainability.

How do I fix cascading useEffect triggers causing performance issues?

Fix cascading useEffect triggers by replacing them with event handlers or selective subscriptions to external data sources. This prevents unnecessary re-renders and optimizes React state management.

Can I use render-time calculations instead of useEffect for state resets?

Yes, render-time calculations can replace useEffect for state resets. By adjusting state directly during render based on prop changes, you avoid stale resets and improve UX predictability.

Does this approach work for managing external data sources in React?

Yes, this approach works for external data sources by using selective subscriptions instead of useEffect. This streamlines data fetching, prevents cascading triggers, and improves overall performance.