react-best-practices

Applies Vercel performance optimization rules when writing or refactoring React and Next.js code.

3|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/langgenius/due-date-hq-jwl --skill react-best-practices-langgenius
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-best-practices
Source: https://github.com/langgenius/due-date-hq-jwl/tree/main/.claude/skills/react-best-practices
Command: npx skills add https://github.com/langgenius/due-date-hq-jwl --skill react-best-practices-langgenius

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? React and Next.js codebases often suffer from slow load times, unnecessary re-renders, and bloated bundles because developers miss subtle performance patterns. This Skill provides a structured, prioritized rule set so AI-assisted code generation and review consistently follows proven optimization practices. ## Core Features & Use Cases - 70 Prioritized Rules Across 8 Categories: Covers eliminating async waterfalls, bundle size optimization, server-side performance, client-side data fetching, re-render optimization, rendering performance, JavaScript micro-optimizations, and advanced patterns, each tagged by impact level from CRITICAL to LOW. - Incorrect vs. Correct Code Examples: Every rule includes concrete before/after TypeScript and TSX examples with explanations, making it directly actionable during code review or refactoring. - Use Case: When reviewing a Next.js page that fetches user, posts, and comments sequentially, apply the async-parallel rule to rewrite the fetches with Promise.all(), cutting three network round trips down to one. ## Quick Start Ask the AI to review your React component or Next.js page for performance issues using the react-best-practices guidelines and suggest concrete fixes.

Frequently Asked Questions about react-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I eliminate async waterfalls in Next.js API routes?

Start independent operations immediately without awaiting them, then await the promises later. For example, call auth() and fetchConfig() without await, then use Promise.all() to resolve them together, reducing sequential round trips to parallel execution.

How to reduce bundle size from barrel file imports in React?

Avoid importing from barrel files like lucide-react or @mui/material entry points, which can load thousands of modules. In Next.js 13.5+, use the optimizePackageImports config option; otherwise import directly from subpaths like @mui/material/Button.

Does this guide cover React Server Components performance?

Yes, it includes server-side rules for RSC such as avoiding duplicate serialization in props, using React.cache() for per-request deduplication, avoiding shared module state for request data, and authenticating Server Actions like public API routes.

When should I use useMemo versus calculating derived state during render?

Calculate derived state directly during rendering instead of using effects, and avoid wrapping simple primitive expressions in useMemo. Reserve memoization for genuinely expensive computations or extracting work into memoized child components.

What is the difference between useEffectEvent and storing handlers in refs?

Both create stable callback references that always call the latest handler without re-triggering effects. useEffectEvent is the modern React API for this pattern, while storing handlers in refs with useRef is the manual equivalent for older React versions.