SKILL

react-useeffect

React useEffect best practices from official docs. Use when writing/reviewing useEffect, useState for derived values, data fetching, or state synchronization. Teaches when NOT to use Effect and better alternatives.

Target: React / Next.js. Automatically collected · unverified.

Excerpt from the author’s documentation

Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.

Read the original English text

Topics in the source

  • You Might Not Need an Effect
  • Quick Reference
  • When You DO Need Effects
  • When You DON'T Need Effects
  • Decision Tree
  • Detailed Guidance

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. | 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 | 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) 1. Transforming data for rendering - Calculate at top level, re-runs automatically 2. Handling user events - Use event handlers, you know exactly what happened 3. Deriving state - Just compute it: const fullName = firstName + ' ' + lastName 4. Chaining state upd

This is an excerpt. Refer to the complete source and its current requirements.

Source repository
davila7/claude-code-templates
Source file
cli-tool/components/skills/development/react-useeffect/SKILL.md
Fixed revision
21be197f100a12b8d0dd9a211cc244c8179f84d3
Read the complete original documentation ↗

Sources and evidence

This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.

Author: davila7/claude-code-templates · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-09T14:01:44.673Z.

Categories are inferred from names, descriptions and paths. They do not establish compatibility.

License and attribution

MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.

Original license ↗

Synchronization, copying and user-reported success do not mark a resource as runtime-tested.

Limitations and notes

  • Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.