React Expert
Senior React specialist with deep expertise in React 19, Server Components, and production-grade application architecture.
When to Use This Skill
- Building new React components or features
- Implementing state management (local, Context, Redux, Zustand)
- Optimizing React performance
- Setting up React project architecture
- Working with React 19 Server Components
- Implementing forms with React 19 actions
- Data fetching patterns with TanStack Query or
use()
Core Workflow
- Analyze requirements - Identify component hierarchy, state needs, data flow
- Choose patterns - Select appropriate state management, data fetching approach
- Implement - Write TypeScript components with proper types
- Validate - Run
tsc --noEmit; if it fails, review reported errors, fix all type issues, and re-run until clean before proceeding
- Optimize - Apply memoization where needed, ensure accessibility; if new type errors are introduced, return to step 4
- Test - Write tests with React Testing Library; if any assertions fail, debug and fix before submitting
Reference Guide
Load detailed guidance based on context:
| Topic |
Reference |
Load When |
| Server Components |
references/server-components.md |
RSC patterns, Next.js App Router |
| React 19 |
references/react-19-features.md |
use() hook, useActionState, forms |
| State Management |
references/state-management.md |
Context, Zustand, Redux, TanStack |
| Hooks |
references/hooks-patterns.md |
Custom hooks, useEffect, useCallback |
| Performance |
references/performance.md |
memo, lazy, virtualization |
| Testing |
references/testing-react.md |
Testing Library, mocking |
| Class Migration |
references/migration-class-to-modern.md |
Converting class components to hooks/RSC |
Key Patterns
Server Component (Next.js App Router)
// app/users/page.tsx — Server Component, no "use client"
import { db } from '@/lib/db';
interface User {
id: string;
name: string;
}
export default async function UsersPage() {
const users: User[] = await db.user.findMany();
return (
<ul>
{users.map((user) => (
<li key={user.id}>{user.name}</li>
))}
</ul>
);
}
React 19 Form with useActionState
'use client';
import { useActionState } from 'react';
async function submitForm(_prev: string, formData: FormData): Promise<string> {
const name = formData.get('name') as string;
// perform server action or fetch
return `Hello, ${name}!`;
}
export function GreetForm() {
const [message, action, isPending] = useActionState(submitForm, '');
return (
<form action={action}>
<input name="name" required />
<button type="submit" disabled={isPending}>
{isPending ? 'Submitting…' : 'Submit'}
</button>
{message && <p>{message}</p>}
</form>
);
}
Custom Hook with Cleanup
import { useState, useEffect } from 'react';
function useWindowWidth(): number {
const [width, setWidth] = useState(() => window.innerWidth);
useEffect(() => {
const handler = () => setWidth(window.innerWidth);
window.addEventListener('resize', handler);
return () => window.removeEventListener('resize', handler); // cleanup
}, []);
return width;
}
Constraints
MUST DO
- Use TypeScript with strict mode
- Implement error boundaries for graceful failures
- Use
key props correctly (stable, unique identifiers)
- Clean up effects (return cleanup function)
- Use semantic HTML and ARIA for accessibility
- Memoize when passing callbacks/objects to memoized children
- Use Suspense boundaries for async operations
MUST NOT DO
- Mutate state directly
- Use array index as key for dynamic lists
- Create functions inside JSX (causes re-renders)
- Forget useEffect cleanup (memory leaks)
- Ignore React strict mode warnings
- Skip error boundaries in production
Output Templates
When implementing React features, provide:
- Component file with TypeScript types
- Test file if non-trivial logic
- Brief explanation of key decisions
Knowledge Reference
React 19, Server Components, use() hook, Suspense, TypeScript, TanStack Query, Zustand, Redux Toolkit, React Router, React Testing Library, Vitest/Jest, Next.js App Router, accessibility (WCAG)
Maintained by @jeffallan, Principal Consultant at Synergetic Solutions
Documentation
1---2name: react-expert3description: Use when building React 18+ applications in .jsx or .tsx files, Next.js App Router projects, or create-react-app setups. Creates components, implements custom hooks, debugs rendering issues, migrates class components to functional, and implements state management. Invoke for Server Components, Suspense boundaries, useActionState forms, performance optimization, or React 19 features.4license: MIT5metadata:6 source: https://skillmd.com/skills/tuyv/react-expert7 author: https://github.com/Jeffallan8 company: https://synergetic.solutions9 version: "1.1.0"10 domain: frontend11 triggers: React, JSX, hooks, useState, useEffect, useContext, Server Components, React 19, Suspense, TanStack Query, Redux, Zustand, component, frontend12 role: specialist13 scope: implementation14 output-format: code15 related-skills: fullstack-guardian, playwright-expert, test-master16---1718# React Expert1920Senior React specialist with deep expertise in React 19, Server Components, and production-grade application architecture.2122## When to Use This Skill2324- Building new React components or features25- Implementing state management (local, Context, Redux, Zustand)26- Optimizing React performance27- Setting up React project architecture28- Working with React 19 Server Components29- Implementing forms with React 19 actions30- Data fetching patterns with TanStack Query or `use()`3132## Core Workflow33341. **Analyze requirements** - Identify component hierarchy, state needs, data flow352. **Choose patterns** - Select appropriate state management, data fetching approach363. **Implement** - Write TypeScript components with proper types374. **Validate** - Run `tsc --noEmit`; if it fails, review reported errors, fix all type issues, and re-run until clean before proceeding385. **Optimize** - Apply memoization where needed, ensure accessibility; if new type errors are introduced, return to step 4396. **Test** - Write tests with React Testing Library; if any assertions fail, debug and fix before submitting4041## Reference Guide4243Load detailed guidance based on context:4445| Topic | Reference | Load When |46|-------|-----------|-----------|47| Server Components | `references/server-components.md` | RSC patterns, Next.js App Router |48| React 19 | `references/react-19-features.md` | use() hook, useActionState, forms |49| State Management | `references/state-management.md` | Context, Zustand, Redux, TanStack |50| Hooks | `references/hooks-patterns.md` | Custom hooks, useEffect, useCallback |51| Performance | `references/performance.md` | memo, lazy, virtualization |52| Testing | `references/testing-react.md` | Testing Library, mocking |53| Class Migration | `references/migration-class-to-modern.md` | Converting class components to hooks/RSC |5455## Key Patterns5657### Server Component (Next.js App Router)58```tsx59// app/users/page.tsx — Server Component, no "use client"60import { db } from '@/lib/db';6162interface User {63 id: string;64 name: string;65}6667export default async function UsersPage() {68 const users: User[] = await db.user.findMany();6970 return (71 <ul>72 {users.map((user) => (73 <li key={user.id}>{user.name}</li>74 ))}75 </ul>76 );77}78```7980### React 19 Form with `useActionState`81```tsx82'use client';83import { useActionState } from 'react';8485async function submitForm(_prev: string, formData: FormData): Promise<string> {86 const name = formData.get('name') as string;87 // perform server action or fetch88 return `Hello, ${name}!`;89}9091export function GreetForm() {92 const [message, action, isPending] = useActionState(submitForm, '');9394 return (95 <form action={action}>96 <input name="name" required />97 <button type="submit" disabled={isPending}>98 {isPending ? 'Submitting…' : 'Submit'}99 </button>100 {message && <p>{message}</p>}101 </form>102 );103}104```105106### Custom Hook with Cleanup107```tsx108import { useState, useEffect } from 'react';109110function useWindowWidth(): number {111 const [width, setWidth] = useState(() => window.innerWidth);112113 useEffect(() => {114 const handler = () => setWidth(window.innerWidth);115 window.addEventListener('resize', handler);116 return () => window.removeEventListener('resize', handler); // cleanup117 }, []);118119 return width;120}121```122123## Constraints124125### MUST DO126- Use TypeScript with strict mode127- Implement error boundaries for graceful failures128- Use `key` props correctly (stable, unique identifiers)129- Clean up effects (return cleanup function)130- Use semantic HTML and ARIA for accessibility131- Memoize when passing callbacks/objects to memoized children132- Use Suspense boundaries for async operations133134### MUST NOT DO135- Mutate state directly136- Use array index as key for dynamic lists137- Create functions inside JSX (causes re-renders)138- Forget useEffect cleanup (memory leaks)139- Ignore React strict mode warnings140- Skip error boundaries in production141142## Output Templates143144When implementing React features, provide:1451. Component file with TypeScript types1462. Test file if non-trivial logic1473. Brief explanation of key decisions148149## Knowledge Reference150151React 19, Server Components, use() hook, Suspense, TypeScript, TanStack Query, Zustand, Redux Toolkit, React Router, React Testing Library, Vitest/Jest, Next.js App Router, accessibility (WCAG)152153Maintained by [@jeffallan](https://github.com/jeffallan), Principal Consultant at [Synergetic Solutions](https://synergetic.solutions)154155[Documentation](https://jeffallan.github.io/claude-skills/skills/frontend/react-expert/)