react-best-practices by mastra-ai/mastra
npx skills add https://github.com/mastra-ai/mastra --skill react-best-practicesReact 应用程序的全面性能优化指南,包含 6 大类共 12 条规则。规则按影响程度排序,以指导自动化重构和代码生成。
在以下情况下参考本指南:
规则按影响程度排序:
| 优先级 | 类别 | 影响 |
|---|---|---|
| 1 | 消除瀑布流 | 关键 |
| 2 | 包大小优化 | 关键 |
| 3 | 客户端数据获取 | 中-高 |
| 4 | 重渲染优化 | 中 |
| 5 | 渲染性能 | 中 |
| 6 | JavaScript 性能 | 低-中 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
消除瀑布流:
Promise.all() (async-parallel)减少包大小:
bundle-barrel-imports)bundle-defer-third-party)客户端数据获取:
client-request-dedupe)重渲染优化:
rerender-lazy-state-init)startTransition (rerender-transitions)useEffect 函数调用 (rerender-useeffect-function-calls)rendering-animate-svg-wrapper)content-visibility: auto (rendering-content-visibility)js-set-map-lookups)toSorted() 而非 sort() (js-tosorted-immutable)js-length-check-first)包含代码示例的完整文档位于:
references/react-best-practices-reference.md - 包含所有模式的完整指南references/rules/ - 按类别组织的独立规则文件要查找特定模式,请在规则目录中使用 grep 命令:
grep -l "Promise.all" references/rules/
grep -l "barrel" references/rules/
grep -l "Tanstack" references/rules/
references/rules/ 中的规则类别async-* - 瀑布流消除 (1 条规则)bundle-* - 包大小优化 (2 条规则)client-* - 客户端数据获取 (1 条规则)rerender-* - 重渲染优化 (3 条规则)rendering-* - DOM 渲染性能 (2 条规则)js-* - JavaScript 微优化 (3 条规则)每周安装量
211
代码仓库
GitHub 星标数
22.3K
首次出现
2026年1月21日
安全审计
安装于
opencode186
gemini-cli182
codex176
cursor176
claude-code175
github-copilot173
Comprehensive performance optimization guide for React applications, containing 12 rules across 6 categories. Rules are prioritized by impact to guide automated refactoring and code generation.
Reference these guidelines when:
Rules are prioritized by impact:
| Priority | Category | Impact |
|---|---|---|
| 1 | Eliminating Waterfalls | CRITICAL |
| 2 | Bundle Size Optimization | CRITICAL |
| 3 | Client-Side Data Fetching | MEDIUM-HIGH |
| 4 | Re-render Optimization | MEDIUM |
| 5 | Rendering Performance | MEDIUM |
| 6 | JavaScript Performance | LOW-MEDIUM |
Eliminate Waterfalls:
Promise.all() for independent async operations (async-parallel)Reduce Bundle Size:
bundle-barrel-imports)bundle-defer-third-party)Client-Side Data Fetching:
client-request-dedupe)Re-render Optimization:
rerender-lazy-state-init)startTransition for non-urgent updates (rerender-transitions)useEffect function calls (rerender-useeffect-function-calls)rendering-animate-svg-wrapper)content-visibility: auto for long lists (rendering-content-visibility)js-set-map-lookups)toSorted() instead of sort() for immutability (js-tosorted-immutable)js-length-check-first)Full documentation with code examples is available in:
references/react-best-practices-reference.md - Complete guide with all patternsreferences/rules/ - Individual rule files organized by categoryTo look up a specific pattern, grep the rules directory:
grep -l "Promise.all" references/rules/
grep -l "barrel" references/rules/
grep -l "Tanstack" references/rules/
references/rules/async-* - Waterfall elimination (1 rule)bundle-* - Bundle size optimization (2 rules)client-* - Client-side data fetching (1 rule)rerender-* - Re-render optimization (3 rules)rendering-* - DOM rendering performance (2 rules)js-* - JavaScript micro-optimizations (3 rules)Weekly Installs
211
Repository
GitHub Stars
22.3K
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode186
gemini-cli182
codex176
cursor176
claude-code175
github-copilot173
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
109,600 周安装