react-patterns

Provide expert guidance and code examples for React 19 development patterns.

2|Updated Jan 5, 2024
One-click install
npx skills add https://github.com/wilfriedago/dotfiles --skill react-patterns-wilfriedago
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-patterns
Source: https://github.com/wilfriedago/dotfiles/tree/main/agents/skills/react-patterns
Command: npx skills add https://github.com/wilfriedago/dotfiles --skill react-patterns-wilfriedago

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and code examples for implementing advanced React patterns, ensuring efficient, scalable, and maintainable frontend applications, especially with the latest React 19 features.

Core Features & Use Cases

  • React 19 Features: Deep dives into Server Components, Actions, use(), useOptimistic, useFormStatus, useFormState, React Compiler, Suspense, and concurrent rendering.
  • Core Patterns: Covers state management (useState, useReducer), side effects (useEffect), custom hooks, component composition, and performance optimization (useMemo, useCallback).
  • TypeScript Integration: Demonstrates best practices for type-safe React development.
  • Use Case: When building a new React 19 application, use this Skill to understand and implement Server Components, Server Actions for mutations, and optimistic UI updates for a seamless user experience.

Quick Start

Use the react-patterns skill to generate a basic React 19 component demonstrating the useOptimistic hook.

Frequently Asked Questions about react-patterns

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

FAQPage Schema
How do I implement optimistic UI updates in React 19?

Optimistic UI updates in React 19 use the useOptimistic hook to immediately show expected state before server mutations complete. You apply it within form Actions to render predicted outcomes seamlessly while asynchronous requests process in the background.

What is the difference between React Server Components and Suspense?

React Server Components render exclusively on the server to reduce bundle size and fetch data directly, while Suspense manages asynchronous rendering on the client by displaying fallback UI. Server Components often integrate with Suspense boundaries to stream HTML progressively.

How do I use the use() hook for concurrent features?

The use() hook in React 19 reads asynchronous resources like Promises directly within components, pausing execution until resolution. Unlike traditional hooks, it enables tight integration with Suspense boundaries for concurrent rendering and data fetching workflows.

How do I integrate TypeScript with custom hooks in React 19?

TypeScript integration with custom hooks involves defining strict interfaces for hook arguments and return types, ensuring type-safe state management. Apply generics to useReducer actions and useState initializers to enforce type checking across component compositions.