Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
0xbigboss avatar

React Best Practices

  • 3k installs
  • 52 repo stars
  • Updated June 24, 2026
  • 0xbigboss/claude-code

react-best-practices is a skill that applies a React Effects decision tree so developers avoid redundant effects and use event handlers, memoization, and composition instead.

About

react-best-practices is a 0xbigboss/claude-code skill that guides React component work with a decision tree for when Effects are appropriate versus event handlers, render-time calculation, useMemo, key-based resets, refs, and useEffectEvent. The core principle treats Effects as escape hatches for synchronizing with external systems such as WebSocket, IntersectionObserver, third-party libraries, and window listeners, not for derived state or user-event responses. It documents anti-patterns including storing derived values in useEffect, effect chains, notifying parents from effects, and reading refs during render. Custom hook guidance prefers focused useXxx hooks that call other hooks, avoids lifecycle helper hooks, and keeps one concrete use case per hook. Component patterns cover controlled versus uncontrolled state, composition over prop drilling, compound components with provider-scoped state, and flushSync when synchronous DOM reads follow updates. The skill pairs with typescript-best-practices for typed React code and defers detailed examples to react-patterns.md. Developers reach for it when reviewing or authoring components that risk redundant effects and extra renders.

  • Decision tree routes user events, derived state, memoization, keys, and external sync.
  • Core rule: most component logic should not use Effects.
  • Documents when to use refs, useEffectEvent, and custom hooks correctly.
  • Warns against effect chains, derived state in effects, and ref reads during render.
  • Pairs with typescript-best-practices and loads react-patterns.md for examples.

React Best Practices by the numbers

  • 3,023 all-time installs (skills.sh)
  • +21 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #182 of 2,245 Frontend Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

react-best-practices capabilities & compatibility

Capabilities
route decisions between event handlers, render c · identify effect anti patterns and derived state · guide custom hook naming and composition pattern · reference react patterns.md for detailed code ex
From the docs

What react-best-practices says it does

Most component logic should NOT use Effects.
SKILL.md
npx skills add https://github.com/0xbigboss/claude-code --skill react-best-practices

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs3k
repo stars52
Security audit3 / 3 scanners passed
Last updatedJune 24, 2026
Repository0xbigboss/claude-code

When should I use useEffect versus event handlers, useMemo, or the key prop in React components?

Apply React component patterns that minimize unnecessary Effects when reading or writing .tsx and .jsx files.

Who is it for?

Developers reading or writing React .tsx and .jsx components who need concrete guidance on Effects, refs, and hook design.

Skip if: Skip for non-React codebases or when you only need Next.js performance rules from a separate Vercel skill.

When should I use this skill?

User is reading or writing React components with .tsx or .jsx files and React imports.

What you get

Components structured with fewer unnecessary Effects, clearer event-handler updates, and patterns aligned to react-patterns.md examples.

  • Component patterns aligned to Effect-minimizing rules

Files

SKILL.mdMarkdownGitHub ↗

React Best Practices

Pair with TypeScript

When working with React, always load both this skill and typescript-best-practices together. TypeScript patterns (type-first development, discriminated unions, Zod validation) apply to React code.

Core Principle: Effects Are Escape Hatches

Effects let you "step outside" React to synchronize with external systems. Most component logic should NOT use Effects. Before writing an Effect, ask: "Is there a way to do this without an Effect?"

Decision Tree

1. Need to respond to user interaction? Use event handler 2. Need computed value from props/state? Calculate during render 3. Need cached expensive calculation? Use useMemo 4. Need to reset state on prop change? Use key prop 5. Need to synchronize with external system? Use Effect with cleanup 6. Need non-reactive code in Effect? Use useEffectEvent 7. Need mutable value that doesn't trigger render? Use ref

When to Use Effects

Synchronizing with external systems: browser APIs (WebSocket, IntersectionObserver), third-party non-React libraries, window/document event listeners, non-React DOM elements (video, maps).

When NOT to Use Effects

  • Derived state — calculate during render
  • Expensive calculations — use useMemo
  • Resetting state on prop change — use key prop
  • Responding to user events — use event handlers
  • Notifying parent of state changes — update both in the same event handler
  • Chains of effects — calculate derived state and update in one event handler

Refs

  • Use for values that don't affect rendering (timer IDs, DOM node references)
  • Never read or write ref.current during render; only in event handlers and effects
  • Use ref callbacks (not useRef in loops) for dynamic lists
  • Use useImperativeHandle to limit what parent can access

Custom Hooks

  • Share logic, not state — each call gets an independent state instance
  • Name useXxx only if it actually calls other hooks; otherwise use a regular function
  • Avoid lifecycle hooks (useMount, useEffectOnce) — use useEffect directly so the linter catches missing deps
  • Keep focused on a single concrete use case

Component Patterns

  • Controlled: parent owns state; uncontrolled: component owns state
  • Prefer composition with children over prop drilling
  • Treat boolean props that switch large component trees (isEditing, isThread, hideAttachments) as a composition smell; prefer separate composed components for distinct use cases
  • For complex reusable UI, prefer compound components with provider-scoped state/actions over monolithic components with many optional props
  • Use Context for scoped component families as well as truly global state, when it defines a local interface consumed by descendants
  • Render JSX directly for UI variation; avoid config-array mini-frameworks unless the config is real domain data
  • Lift the provider boundary when sibling or external controls need access to the same state/actions
  • Use flushSync when you need to read the DOM synchronously after a state update

See react-patterns.md for code examples and detailed patterns.

Related skills

How it compares

Use react-best-practices for React-specific hook and effect patterns; use a broader frontend-design skill when the task is visual UI composition rather than hooks correctness.

FAQ

When should I use useEffect in React?

Only to synchronize with external systems like browser APIs, third-party libraries, or non-React DOM elements, with cleanup when needed.

How do I reset state when a prop changes?

Use the key prop on the component rather than an Effect that copies props into state.

Does react-best-practices include code examples?

SKILL.md summarizes patterns; react-patterns.md holds detailed before-and-after examples.

Is React Best Practices safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.