react-patterns

Apply React patterns for component design, hooks, state, and performance.

1|Updated Dec 28, 2025
One-click install
npx skills add https://github.com/barbosakjn/finance-app --skill react-patterns-barbosakjn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-patterns
Source: https://github.com/barbosakjn/finance-app/tree/main/.agent/workflows/.agent/skills/react-patterns
Command: npx skills add https://github.com/barbosakjn/finance-app --skill react-patterns-barbosakjn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide helps frontend teams reduce cognitive load and avoid common pitfalls by codifying React patterns, performance considerations, and type-safe practices for scalable apps.

Core Features & Use Cases

  • Component Design Principles: server, client, presentational, and container roles with clear rules like one responsibility per component and composition over inheritance.
  • Hook Patterns: guidance on when to extract hooks, rules for use at top level, and naming conventions like starting with use.
  • State Management & Architecture: guidance on selecting approaches (useState, useReducer, Context, React Query/SWR, and global stores) based on scope.
  • React 19 Patterns: new hooks and compiler benefits that influence how resources are read and UI is updated.
  • Composition Patterns: compound components and render props vs hooks for flexible, reusable UI.
  • Performance Principles: when to optimize, profiling, memoization, virtualization, and stable callbacks.
  • Error Handling: error boundaries, recovery strategies, and resilient UX.
  • TypeScript Patterns: typing props, generics, and common types to ensure type safety.
  • Testing Principles: unit, integration, and e2e testing guidance and priorities.
  • Anti-Patterns: common pitfalls to avoid and suggested improvements.

Quick Start

Explain a React component you’re building, and I will apply patterns to improve its structure and performance.

Frequently Asked Questions about react-patterns

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

FAQPage Schema
What are the best React patterns for building scalable and maintainable frontend apps?

React patterns for scalable apps include using container and presentational components, extracting custom hooks, applying composition over inheritance, and selecting state management approaches based on scope. These practices reduce cognitive load and ensure maintainability.

How do I choose between useState, useReducer, and Context for React state management?

Choosing React state management depends on scope: useState for local component state, useReducer for complex logic, Context for cross-component data, and React Query or SWR for server state. Selecting the right approach ensures scalable architecture.

When should I optimize React performance using memoization and virtualization?

Optimize React performance with memoization and virtualization only after profiling reveals bottlenecks. Use stable callbacks and memo to prevent unnecessary re-renders, and apply virtualization for large lists to maintain smooth UI interactions.

How do I apply TypeScript typing patterns to React component props and generics?

Apply TypeScript typing patterns to React components by strictly defining prop types, leveraging generics for reusable components, and utilizing common types for hooks and state. This ensures type safety and prevents runtime errors in client-side applications.

What are common React anti-patterns to avoid when designing components and hooks?

Common React anti-patterns include breaking hook rules by using them conditionally, overusing inheritance, and ignoring error boundaries. Avoid these pitfalls by adhering to one responsibility per component and using composition for flexible, reusable UI.