react-19

Guide for React 19 development with Actions, Server Components, and new hooks. Use for building React 19 apps, form handling, optimistic updates, and migrations.

242 stars

Best use case

react-19 is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Guide for React 19 development with Actions, Server Components, and new hooks. Use for building React 19 apps, form handling, optimistic updates, and migrations.

Guide for React 19 development with Actions, Server Components, and new hooks. Use for building React 19 apps, form handling, optimistic updates, and migrations.

Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.

Practical example

Example input

Use the "react-19" skill to help with this workflow task. Context: Guide for React 19 development with Actions, Server Components, and new hooks. Use for building React 19 apps, form handling, optimistic updates, and migrations.

Example output

A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.

When to use this skill

  • Use this skill when you want a reusable workflow rather than writing the same prompt again and again.

When not to use this skill

  • Do not use this when you only need a one-off answer and do not need a reusable workflow.
  • Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/react-19/SKILL.md --create-dirs "https://raw.githubusercontent.com/aiskillstore/marketplace/main/skills/calel33/react-19/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/react-19/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How react-19 Compares

Feature / Agentreact-19Standard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Guide for React 19 development with Actions, Server Components, and new hooks. Use for building React 19 apps, form handling, optimistic updates, and migrations.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# React 19

React 19 (stable since Dec 2024) simplifies async operations, improves SSR, and enhances DX with Actions, Server Components, and new hooks.

## When to Use

- Building React 19 applications
- Async form handling with automatic pending/error states
- Server Components for SSR
- Optimistic UI updates
- Migrating from React 18
- Server Actions for full-stack forms

## Installation

```bash
npm install react@19.2.1 react-dom@19.2.1
npm install --save-dev @types/react@19.0.0 @types/react-dom@19.0.0
```

**Required:** Enable modern JSX transform in `tsconfig.json`:
```json
{ "compilerOptions": { "jsx": "react-jsx" } }
```

## Core Concepts

### Execution Boundaries

| Type | Runs | State | Access |
|------|------|-------|--------|
| Server Component | Server | No | DB, FS, Secrets |
| Client Component | Browser | Yes | DOM, Browser APIs |
| Server Action | Server | No | DB, APIs |

### Conventions

- `"use server"` = Server Action
- `"use client"` = Client Component
- No directive = Server Component (in RSC environment)
- `async` component = Auto-suspends

## Essential Patterns

### 1. Forms with useActionState

```javascript
'use client';
import { useActionState } from 'react';

function SignupForm() {
  const [state, formAction, isPending] = useActionState(
    async (prev, formData) => {
      const error = await createUser(formData.get('email'));
      return error ? { error } : null;
    },
    { error: null }
  );

  return (
    <form action={formAction}>
      <input type="email" name="email" required />
      <button disabled={isPending}>
        {isPending ? 'Signing up...' : 'Sign Up'}
      </button>
      {state.error && <p>{state.error}</p>}
    </form>
  );
}
```

### 2. Optimistic Updates

```javascript
'use client';
import { useOptimistic } from 'react';

function Comments({ comments, addComment }) {
  const [optimistic, addOptimistic] = useOptimistic(
    comments,
    (curr, newComment) => [...curr, { ...newComment, pending: true }]
  );

  return (
    <div>
      {optimistic.map(c => <div key={c.id}>{c.text}</div>)}
      <form action={async (formData) => {
        addOptimistic({ id: Date.now(), text: formData.get('text') });
        await addComment(formData);
      }}>
        <input name="text" />
        <button>Post</button>
      </form>
    </div>
  );
}
```

### 3. Server Actions

```javascript
'use server';
export async function createPost(formData) {
  const title = formData.get('title');
  if (!title || title.length < 3) {
    return { error: 'Title too short' };
  }
  await db.posts.create({ title });
  revalidatePath('/posts');
}
```

### 4. Streaming with Suspense

```javascript
export default function Dashboard() {
  return (
    <div>
      <Suspense fallback={<Skeleton />}>
        <RevenueCard />
      </Suspense>
      <Suspense fallback={<Skeleton />}>
        <UsersCard />
      </Suspense>
    </div>
  );
}

async function RevenueCard() {
  const data = await db.analytics.getRevenue();
  return <div>{data}</div>;
}
```

## Security Essentials

```javascript
// 1. Always authenticate
'use server';
export async function deleteUser(id) {
  const user = await getCurrentUser();
  if (!user) throw new Error('Unauthorized');
  await db.users.delete(id);
}

// 2. Keep secrets server-side
'use server';
export async function fetchData() {
  const secret = process.env.API_SECRET; // Inside function!
  return fetch(url, { headers: { Authorization: `Bearer ${secret}` }});
}

// 3. Validate inputs
import { z } from 'zod';
const schema = z.object({ email: z.string().email() });
const result = schema.safeParse(formData);
```

See `references/security-guide.md` for complete security guidance.

## Migration from React 18

1. Update to React 18.3 first (fix warnings)
2. Update to React 19: `npm install react@19 react-dom@19`
3. Run codemods: `npx codemod@latest react/19/migration-recipe`
4. Fix TypeScript: `npx types-react-codemod@latest preset-19 ./src`
5. Test thoroughly

**Key breaking changes:**
- `ReactDOM.render` → `createRoot`
- `PropTypes` removed → Use TypeScript
- `forwardRef` deprecated → Use `ref` as prop
- `useRef()` requires argument → `useRef(null)`

See `references/upgrade-checklist.md` and `references/migration-patterns.md`.

## Quick Reference

### New Hooks

| Hook | Purpose |
|------|---------|
| `useActionState` | Form state with async actions |
| `useOptimistic` | Instant UI feedback |
| `use()` | Read promises/context (can be conditional) |
| `useTransition` | Non-urgent updates |

See `references/hooks-api.md` for detailed API docs.

### When to Use What

| Task | Solution |
|------|----------|
| Forms | `useActionState` + Server Actions |
| Instant UI | `useOptimistic` |
| Data fetching | Server Components with `async/await` |
| Refs | `ref` as regular prop |
| Progressive rendering | Suspense boundaries |

## Reference Files

- **references/hooks-api.md** - Complete hook documentation
- **references/migration-patterns.md** - Detailed migration guide
- **references/advanced-examples.md** - Production examples
- **references/security-guide.md** - Security best practices
- **references/upgrade-checklist.md** - Step-by-step upgrade
- **references/core-workflows.md** - 5 essential patterns with full examples

## Resources

- React 19 Docs: https://react.dev
- Next.js 15 Docs: https://nextjs.org/docs

**Version:** 2.1 | **Updated:** 2025-12-27

Related Skills

react-native-design

242
from aiskillstore/marketplace

Master React Native styling, navigation, and Reanimated animations for cross-platform mobile development. Use when building React Native apps, implementing navigation patterns, or creating performant animations.

react-useeffect

242
from aiskillstore/marketplace

React useEffect best practices from official docs. Use when writing/reviewing useEffect, useState for derived values, data fetching, or state synchronization. Teaches when NOT to use Effect and better alternatives.

react-dev

242
from aiskillstore/marketplace

This skill should be used when building React components with TypeScript, typing hooks, handling events, or when React TypeScript, React 19, Server Components are mentioned. Covers type-safe patterns for React 18-19 including generic components, proper event typing, and routing integration (TanStack Router, React Router).

react-state-management

242
from aiskillstore/marketplace

Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query. Use when setting up global state, managing server state, or choosing between state management solutions.

react-native-architecture

242
from aiskillstore/marketplace

Build production React Native apps with Expo, navigation, native modules, offline sync, and cross-platform patterns. Use when developing mobile apps, implementing native integrations, or architecting React Native projects.

react-modernization

242
from aiskillstore/marketplace

Upgrade React applications to latest versions, migrate from class components to hooks, and adopt concurrent features. Use when modernizing React codebases, migrating to React Hooks, or upgrading to latest React versions.

react-flow-node-ts

242
from aiskillstore/marketplace

Create React Flow node components with TypeScript types, handles, and Zustand integration. Use when building custom nodes for React Flow canvas, creating visual workflow editors, or implementing node-based UI components.

react-flow-architect

242
from aiskillstore/marketplace

Expert ReactFlow architect for building interactive graph applications with hierarchical node-edge systems, performance optimization, and auto-layout integration. Use when Claude needs to create or optimize ReactFlow applications for: (1) Interactive process graphs with expand/collapse navigation, (2) Hierarchical tree structures with drag & drop, (3) Performance-optimized large datasets with incremental rendering, (4) Auto-layout integration with Dagre, (5) Complex state management for nodes and edges, or any advanced ReactFlow visualization requirements.

fp-ts-react

242
from aiskillstore/marketplace

Practical patterns for using fp-ts with React - hooks, state, forms, data fetching. Use when building React apps with functional programming patterns. Works with React 18/19, Next.js 14/15.

react-email

242
from aiskillstore/marketplace

Use when creating HTML email templates with React components - welcome emails, password resets, notifications, order confirmations, newsletters, or transactional emails.

react-native-dev

242
from aiskillstore/marketplace

React Native and Expo development guide covering components, styling, animations, navigation, state management, forms, networking, performance optimization, testing, native capabilities, and engineering (project structure, deployment, SDK upgrades, CI/CD). Use when: building React Native or Expo apps, implementing animations or native UI, managing state, fetching data, writing tests, optimizing performance, deploying to App Store/Play Store, setting up CI/CD, upgrading Expo SDK, or configuring Tailwind/NativeWind.

react-components

242
from aiskillstore/marketplace

Converts Stitch designs into modular Vite and React components using system-level networking and AST-based validation.