react-best-practices

Optimize React and Next.js performance by addressing waterfalls, bundle size, and re-renders.

Updated Mar 24, 2026
One-click install
npx skills add https://github.com/Icebane84/Synarche_Workshop --skill react-best-practices-icebane84
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-best-practices
Source: https://github.com/Icebane84/Synarche_Workshop/tree/main/.agent/skills/lang/nextjs-react-expert
Command: npx skills add https://github.com/Icebane84/Synarche_Workshop --skill react-best-practices-icebane84

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps you prevent common performance failures in React and Next.js projects—especially sequential data-fetching waterfalls, excessive bundle size, slow server-side rendering, and unnecessary re-renders—so your UI loads faster and feels more responsive.

Core Features & Use Cases

  • Eliminate waterfalls: restructure async flows to run independent work in parallel, use Suspense strategically, and reduce end-to-end latency.
  • Shrink bundle size: avoid barrel import bloat, prefer direct imports, use dynamic imports for heavy components, and preload based on user intent.
  • Optimize server & RSC boundaries: authenticate server actions, avoid unnecessary serialization across RSC/client boundaries, parallelize server component fetching, and apply caching/deduplication correctly.
  • Improve client data fetching: use SWR for automatic deduplication and caching, and minimize expensive localStorage patterns.
  • Reduce re-renders & rendering cost: derive state correctly, stabilize memoization inputs, narrow effect dependencies, and apply targeted rendering/perf techniques (e.g., content-visibility).
  • Micro-optimize hot paths safely: cache repeated lookups/calls and avoid mutation pitfalls like sort() on props/state.

Quick Start

Use the react-best-practices skill to fix slow page loads by applying the waterfall eliminations and bundle-size rules first, then moving to server, client, and re-render optimizations for the specific symptoms you observe.

Frequently Asked Questions about react-best-practices

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

FAQPage Schema
How do I fix sequential data-fetching waterfalls in React and Next.js?

Fix data-fetching waterfalls by restructuring async flows to run independent work in parallel, applying Suspense strategically, and using SWR for automatic deduplication to reduce end-to-end latency.

What's the best way to reduce React bundle size caused by barrel imports?

Reduce React bundle size by avoiding barrel import bloat, preferring direct imports, using dynamic imports for heavy components, and preloading resources based on user intent.

How do I optimize unnecessary re-renders in React components?

Optimize React re-renders by deriving state correctly, stabilizing memoization inputs, narrowing effect dependencies, and applying targeted techniques like content-visibility to reduce rendering cost.

Does this approach work for optimizing server-side rendering and RSC boundaries in Next.js?

Yes, it optimizes Next.js server-side rendering by parallelizing server component fetching, authenticating server actions, avoiding unnecessary serialization across RSC boundaries, and applying caching correctly.

Why are my React props mutating during render and how do I prevent it?

Prevent React prop mutation by avoiding direct mutation pitfalls like calling sort() on props or state, and instead cache repeated lookups or calls to micro-optimize hot paths safely.

When should I not use dynamic imports for React components?

Avoid dynamic imports when a component is critical for initial page load, as overusing them can delay rendering; instead, reserve dynamic imports for heavy, below-the-fold components to shrink initial bundle size.