AGENT SKILL

react

Use when building or reviewing React component architecture, hooks usage, and performance patterns. Do not use when the work is framework-agnostic styling, routing, or state management owned by another skill.

License 许可
MIT
最近更新
2026-10-08
Stars
★ 0
Forks
0

01 前言 Front Matter

name
react
license
MIT
metadata
{ "owner": "Harley Bartles", "scope": "React component architecture, hooks usage, and performance patterns.", "status": "active", "use_when": [ "building or reviewing React component architecture.", "choosing, ordering, or refactoring hooks.", "lifting state, composing components, or handling conditional rendering.", "optimizing renders with memo, useMemo, useCallback, or React.memo.", "deciding whether server components or a framework-specific skill is more appropriate." ], "source-id": "react", "source-path": "skills/react/SKILL.md", "related_skills": [ "typescript", "web-styling" ], "do_not_use_when": [ "the work is framework-agnostic styling; use the web-styling skill.", "the work is TypeScript-specific type design; use the typescript skill.", "the work is routing or global state management owned by another skill.", "the task requires Next.js or framework-specific server components; use the appropriate framework skill." ], "provenance-name": "React first-party skill", "source-category": "first_party" }
description
Use when building or reviewing React component architecture, hooks usage, and performance patterns. Do not use when the work is framework-agnostic styling, routing, or state management owned by another skill.

02 资源文件 5

03 SKILL.md 正文

React

Overview

React lets you build UIs from declarative components. This skill covers component architecture, hooks, and performance patterns grounded in the React documentation.

When to Use

  • Designing or reviewing functional components and JSX.
  • Choosing, ordering, or refactoring hooks (useState, useEffect, useContext, custom hooks).
  • Lifting state, composing children, or handling conditional rendering.
  • Optimizing renders with memo, useMemo, useCallback, or React.memo.
  • Deciding when server components or a framework-specific skill such as Next.js is more appropriate.

Do not use for framework-agnostic styling; defer to web-styling. Do not use for TypeScript-only type design; defer to typescript. Do not use for routing, global state management, or framework-specific server frameworks.

Core Pattern

  1. Favor small, single-responsibility functional components.
  2. Keep hooks at the top level and outside loops, conditions, and nested functions.
  3. Lift state to the closest common ancestor and pass data down through props.
  4. Use useEffect to synchronize with external systems, not to derive state.
  5. Memoize only after measuring; avoid premature optimization.

Common Mistakes

  • Calling hooks conditionally or inside loops.
  • Using useEffect to transform state that can be derived during render.
  • Passing new object or array literals to optimized children without memoization.
  • Mixing presentational concerns with side effects.
  • Choosing server components or Next.js when only client-side composition is needed.

04 同仓库更多 Skills