react-best-practices

Apply React and Next.js performance patterns to components and pages.

321|37|Updated Jun 15, 2023
One-click install
npx skills add https://github.com/nikolovlazar/dotfiles --skill react-best-practices-nikolovlazar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-best-practices
Source: https://github.com/nikolovlazar/dotfiles/tree/main/.agents/skills/react-best-practices
Command: npx skills add https://github.com/nikolovlazar/dotfiles --skill react-best-practices-nikolovlazar

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

React and Next.js projects often suffer from performance regressions as complexity grows, causing slow renders, bloated bundles, and inefficient data fetching. This skill provides a structured, battle-tested set of patterns to optimize rendering, loading, and server/client interaction for scalable React apps.

Core Features & Use Cases

  • Eliminate waterfalls by parallelizing async operations and applying Suspense boundaries to stream content.
  • Reduce bundle size by avoiding barrel imports, preferring direct imports, and leveraging dynamic imports and code-splitting.
  • Improve server-side and client-side data fetching with caching, deduplication, and strategic data-fetch patterns across React Server Components and client components.
  • Real-world use case: apply these guidelines when building a Next.js page that fetches data, renders UI, and ships minimal JavaScript.

Quick Start

Audit a React/Next.js page and apply the outlined patterns to improve rendering speed and load times.

Frequently Asked Questions about react-best-practices

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

FAQPage Schema
How do I optimize React and Next.js rendering performance and reduce bundle size?

Optimize React and Next.js rendering performance by applying best-practice patterns for data fetching, code-splitting, and server/client boundaries. These actionable guidelines ensure minimal JavaScript shipping and production-grade rendering speed.

What is the best way to prevent waterfalls in Next.js data fetching?

Prevent data fetching waterfalls by parallelizing asynchronous operations and strategically applying Suspense boundaries to stream content. This approach improves loading times across React Server Components and client components.

How do I reduce JavaScript bundle size when building React components?

Reduce JavaScript bundle size by avoiding barrel imports, preferring direct imports, and leveraging dynamic imports for code-splitting. These patterns minimize the final payload shipped to the browser.

Does this approach work for optimizing both server-side and client-side data fetching?

Yes, this approach optimizes both server-side and client-side data fetching by applying caching, deduplication, and strategic data-fetch patterns across React Server Components and client components.

When should I use Suspense boundaries for React performance optimization?

Use Suspense boundaries to stream content and eliminate waterfalls when building Next.js pages that fetch data and render UI. This ensures efficient loading states and faster perceived performance.