react-patterns

Implement React 19 patterns for compiler-friendly components and Server Actions forms.

278|29|Updated Nov 4, 2025
One-click install
npx skills add https://github.com/MadAppGang/claude-code --skill react-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-patterns
Source: https://github.com/MadAppGang/claude-code/tree/main/plugins/frontend/skills/react-patterns
Command: npx skills add https://github.com/MadAppGang/claude-code --skill react-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Keeping up with the latest React 19 features like the React Compiler, Server Actions, and new hooks can be challenging. This Skill provides best practices for building performant and maintainable React applications.

Core Features & Use Cases

  • Compiler-Friendly Code: Write components optimized by the React Compiler for automatic memoization and performance gains.
  • React 19 Actions: Implement form-centric mutations with useActionState and useOptimistic for built-in validation and optimistic UI.
  • use Hook: Leverage the new use hook for unwrapping Promises and Context, especially with Suspense.
  • Decision Guide: Understand when to choose between React Actions and TanStack Query mutations for different scenarios.
  • Use Case: Implement a "create todo" form using React 19 Actions, complete with validation and an optimistic update that instantly shows the new todo in the list.

Quick Start

Use the react-patterns skill to implement a compiler-friendly UserCard component.

Frequently Asked Questions about react-patterns

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

FAQPage Schema
How do I optimize React components with the React Compiler?

The React Compiler automatically memoizes compiler-friendly components, eliminating manual optimization. Write pure components with serializable props, derive values during render, and use inline event handlers to enable compiler recognition and automatic performance gains without code changes.

How do I build forms with React 19 Server Actions and optimistic updates?

Use `useActionState` to handle form mutations server-side and `useOptimistic` to instantly reflect changes in the UI before the server responds. This pattern provides built-in validation, error handling, and a seamless user experience with minimal boilerplate.

Should I use React Actions or TanStack Query for mutations?

React Actions suit form-centric, server-driven workflows with built-in validation and streaming. TanStack Query works better for client-side cache management and complex async workflows. Choose based on whether your mutations are server-initiated or client-managed.

What does the `use` hook do in React 19?

The `use` hook unwraps Promises and Context values, enabling components to suspend until data resolves. It integrates seamlessly with Suspense for cleaner async data handling and context consumption patterns.

Can I use the React Compiler with existing codebases?

Yes. Opt in gradually by marking components with 'use no memo' during refactoring. The compiler coexists with manual memoization; enable it incrementally as you adopt compiler-friendly patterns like pure props and inline handlers.

Does React 19 work with Server-Side Rendering and hybrid workloads?

React 19 Actions, the Compiler, and new hooks support SPA, SSR, and hybrid architectures. Server Actions execute server-side, streaming responses work with Suspense, and compiler optimization applies across all rendering modes.