SKILL

react-patterns

React 18/19 模式,涵盖 hooks 规范、服务端/客户端组件边界、Suspense 与错误边界、表单 action、数据获取、状态管理决策树,以及优先考虑无障碍的组合方式。编写或审查 React 组件时使用。

译文已校对
查看英文原文

React 18/19 patterns including hooks discipline, server/client component boundaries, Suspense + error boundaries, form actions, data fetching, state management decision trees, and accessibility-first composition. Use when writing or reviewing React components.

适用对象:React / Next.js。自动收录 · 待核查。

原作者说明节选

从固定版本的 SKILL.md 提取,保留原文语言。以下内容属于作者说明,本站尚未验证安装、兼容或运行结果。

查看英文原文

原文涵盖的主题

  • React Patterns
  • When to Activate
  • Core Principles
  • 1. Render is a Pure Function of Props and State
  • 2. Side Effects Outside Render
  • 3. Composition Over Inheritance
  • Hooks Discipline
  • State Location Decision Tree

Idiomatic React 18/19 patterns for building robust, accessible, performant component trees. Writing or modifying React function components, custom hooks, or component trees Reviewing JSX/TSX files Designing state shape or component composition Migrating class components or older forwardRef/useEffect-heavy code Choosing between local state, lifted state, context, and external stores Working with Server Components / Client Components (Next.js App Router, RSC) Implementing forms with React 19 actions or controlled inputs Wiring data fetching with TanStack Query / SWR / RSC Derived state in useEffect adds a render cycle, can desync, and obscures the data flow. Effects, mutations, network calls, and subscriptions live in event handlers or useEffect — never in the render body. React has no inheritance model for components. Compose with children, render props, or component props. See rules/react/hooks.md for the full ruleset. Highlights: Top-level only, never conditional Cleanup every subscription, interval, listener Functional updater (setX(prev => prev + 1)) when new state depends on old Default position: do not memoize — add useMemo/useCallback only when a profiler or a dependency chai

这里只展示节选,请以完整原文和当前要求为准。

来源仓库
affaan-m/ECC
源文件
pi/core/skills/react-patterns/SKILL.md
固定版本
d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
阅读完整原作者说明 ↗

来源与内容状态

本条为自动发现的元数据,尚未完成人工文档核查;适用性与运行结果待核查。

原作者:affaan-m/ECC · 原作者仓库元数据。文档核查:未核查。最近来源检查:2026-11-09T15:01:43.236Z。

分类由名称、说明与路径规则生成,分类不代表已核实适配。

许可与权利归属

MIT。第三方内容及版权归原作者,使用条件以原文为准。

许可原文 ↗

本站没有因同步、复制或用户自报成功而将资源标为运行验证通过。

限制与注意事项

  • 元数据收录不代表本站已经安装、适配、实测或进行安全审查。