benefriches-react-best-practices

Apply Benefriches-specific React performance best practices to components, Redux selectors, and thunks.

45|3|Updated Jul 10, 2023
One-click install
npx skills add https://github.com/incubateur-ademe/benefriches --skill benefriches-react-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: benefriches-react-best-practices
Source: https://github.com/incubateur-ademe/benefriches/tree/main/.claude/skills/react-best-practices
Command: npx skills add https://github.com/incubateur-ademe/benefriches --skill benefriches-react-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a comprehensive set of React performance best practices tailored for Benefriches. It helps developers optimize component rendering, reduce bundle size, and improve UX in a Vite + Redux SPA.

Core Features & Use Cases

  • Guidance on avoiding barrel imports, dynamic imports, Promise.all patterns, and parallelization.
  • Patterns for memoization, Suspense boundaries, conditional module loading, and transitions to keep UI responsive.
  • Concrete examples and refactoring steps for reducers/selectors to use immutable operations like toSorted.

Quick Start

Analyze a React component and generate concrete optimization steps according to the guide.

Frequently Asked Questions about benefriches-react-best-practices

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

FAQPage Schema
How do I reduce React bundle size when using Vite and Redux?

Optimize React component re-renders by applying memoization patterns, using immutable Redux operations like replacing sort with toSorted, and structuring selectors properly. This prevents unnecessary UI updates and keeps the interface responsive during state changes.

What is the best way to handle async data fetching with Suspense in React?

Handle async data in React by implementing Suspense boundaries and using Promise.all patterns for parallelization. This approach keeps the UI responsive while waiting for data loads and integrates with conditional module loading workflows.

Does this React performance optimization approach work with standard Node and NPM tooling?

Yes, the optimization approach relies on standard Node and NPM tooling within a Vite environment. It applies standard React and Redux patterns without requiring external dependencies, fitting directly into the existing development workflow.

Why should I use toSorted instead of sort for Redux reducers?

Use toSorted instead of sort to maintain immutability in Redux reducers. The sort method mutates the original array in place, which violates Redux state management principles, whereas toSorted returns a new sorted array safely.

How do I start analyzing a React component for performance optimizations?

Analyze a React component by passing it to this Skill to generate concrete optimization steps. It evaluates the component against best practices for memoization, bundle-size reduction, and code-splitting to provide actionable refactoring guidance.