react-patterns

Guides React component design, hooks, composition, and TypeScript patterns for production applications.

1|Updated Jul 20, 2026
One-click install
npx skills add https://github.com/gonzoblasco/ai-developer-stack --skill react-patterns-gonzoblasco
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: react-patterns
Source: https://github.com/gonzoblasco/ai-developer-stack/tree/main/frontend-ui/react-patterns
Command: npx skills add https://github.com/gonzoblasco/ai-developer-stack --skill react-patterns-gonzoblasco

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It helps developers structure React applications correctly by providing clear decision criteria for component types, state placement, hook extraction, and performance optimization, avoiding common anti-patterns like prop drilling and premature memoization. ## Core Features & Use Cases - Component Design Matrix: Categorizes components as Server, Client, Presentational, or Container with rules for responsibility and data flow. - React 19 Patterns: Covers new hooks like useActionState, useOptimistic, and use, plus compiler-driven automatic memoization. - State Management Selection: Decision tables mapping complexity levels to useState, Context, React Query, Zustand, or Redux Toolkit. - Use Case: When building a new feature with tabs and forms, consult the compound component pattern and useActionState guidance to structure flexible, typed components without prop drilling. ## Quick Start Ask the AI to review your React component structure and suggest the right state management approach and composition pattern using the react-patterns guidelines.

Frequently Asked Questions about react-patterns

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

FAQPage Schema
How do I choose between useState, Context, and Zustand in React?▼

Use useState for single-component state, Context for state shared within a subtree, and Zustand or Redux Toolkit for complex app-wide state. Server state should use React Query or SWR rather than client stores.

What are compound components in React?▼

Compound components are a composition pattern where a parent component provides context and its children consume it transparently, as in Tabs and Tab. This enables flexible slot-based layouts without prop drilling.

What new hooks does React 19 introduce?▼

React 19 adds useActionState for form submission state, useOptimistic for optimistic UI updates, and use for reading resources during render. The compiler also provides automatic memoization, reducing manual useMemo and useCallback usage.

When should I extract a custom hook in React?▼

Extract a custom hook when the same logic repeats across components, such as useLocalStorage for storage access, useDebounce for debounced values, or useFetch for repeated fetch patterns. Custom hooks must start with 'use' and follow hook rules.

When should I not optimize React performance with useMemo?▼

Avoid premature optimization: first verify the render is actually slow, profile with React DevTools, and identify the real bottleneck. Only then apply targeted fixes like useMemo for expensive calculations or virtualization for large lists.