---
name: react
description: React 19 components and hooks.
title: react
canonical_url: https://skilld.dev/gh/pymodel/react-frontend-skills/react
last_updated: 2026-11-12T09:04:44.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> 45 supporting files sit beside this SKILL.md. When the Skill refers to one, fetch https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/PATH with PATH replaced.
>
> If the user asked to install this Skill, run `npx skilld install pymodel/react-frontend-skills/react`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/react`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/pymodel/react-frontend-skills/react) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/react`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/react --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/react --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# React 19 Best Practices

Comprehensive performance optimization guide for React 19 applications. Contains 44 rules across 8 categories, prioritized by impact from critical (concurrent rendering, server components) to incremental (component patterns). Covers the React 19.3 stabilizations: `<ViewTransition>`, Fragment refs, and direct Context providers in Server Components.

## Table of Contents

1. [Concurrent Rendering](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/_sections.md#1-concurrent-rendering-conc) — **CRITICAL**
   - 1.1 [Avoid Suspense Fallback Thrashing](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/conc-suspense-fallback.md) — HIGH (prevents flickering, smoother UX)
   - 1.2 [Leverage Automatic Batching for Fewer Renders](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/conc-automatic-batching.md) — HIGH (fewer renders in heavy updates)
   - 1.3 [Use useDeferredValue for Derived Expensive Values](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/conc-use-deferred-value.md) — CRITICAL (prevents jank in derived computations)
   - 1.4 [Use useTransition for Non-Blocking Updates](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/conc-use-transition.md) — CRITICAL (keeps UI responsive during heavy updates)
   - 1.5 [Write Concurrent-Safe Components](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/conc-concurrent-safe.md) — MEDIUM-HIGH
   - 1.6 [Animate UI Changes with ViewTransition](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/conc-view-transitions.md) — MEDIUM (native View Transition API animations without manual class juggling)
2. [Server Components](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/_sections.md#2-server-components-rsc) — **CRITICAL**
   - 2.1 [Avoid Client-Only Libraries in Server Components](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rsc-avoid-client-only-libs.md) — MEDIUM-HIGH
   - 2.2 [Enable Streaming with Nested Suspense](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rsc-streaming.md) — MEDIUM-HIGH
   - 2.3 [Fetch Data in Server Components](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rsc-data-fetching-server.md) — CRITICAL (less client JS, no client waterfalls)
   - 2.4 [Minimize Server/Client Boundary Crossings](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rsc-server-client-boundary.md) — CRITICAL (reduces serialization overhead, smaller bundles)
   - 2.5 [Pass Only Serializable Props to Client Components](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rsc-serializable-props.md) — HIGH (prevents runtime errors, ensures correct hydration)
   - 2.6 [Use Composition to Mix Server and Client Components](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rsc-composition-pattern.md) — HIGH (maintains server rendering for static content)
   - 2.7 [Render Context Providers in Server Components](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rsc-context-provider.md) — LOW-MEDIUM (removes provider-wrapper components from the client tree; 19.3)
3. [Actions & Forms](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/_sections.md#3-actions--forms-form) — **HIGH**
   - 3.1 [Use Form Actions Instead of onSubmit](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/form-actions.md) — HIGH (progressive enhancement, simpler code)
   - 3.2 [Use useActionState for Form State Management](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/form-use-action-state.md) — HIGH (declarative form handling, automatic pending states)
   - 3.3 [Use useFormStatus for Submit Button State](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/form-use-form-status.md) — MEDIUM-HIGH
   - 3.4 [Use useOptimistic for Instant UI Feedback](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/form-use-optimistic.md) — HIGH (instant perceived response, auto-rollback on failure)
   - 3.5 [Validate Forms on Server with Actions](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/form-validation.md) — MEDIUM (secure validation, consistent error handling)
4. [Data Fetching](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/_sections.md#4-data-fetching-data) — **HIGH**
   - 4.1 [Fetch Data in Parallel with Promise.all](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/data-parallel-fetching.md) — MEDIUM-HIGH
   - 4.2 [Use cache() for Request Deduplication](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/data-cache-deduplication.md) — HIGH (eliminates duplicate fetches per render)
   - 4.3 [Use Error Boundaries with Suspense](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/data-error-boundaries.md) — MEDIUM (graceful error recovery, isolated failures)
   - 4.4 [Use Suspense for Declarative Loading States](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/data-suspense-data-fetching.md) — HIGH (cleaner code, coordinated loading UI)
   - 4.5 [Use the use() Hook for Promises in Render](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/data-use-hook.md) — HIGH (cleaner async component code, Suspense integration)
5. [State Management](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/_sections.md#5-state-management-rstate) — **MEDIUM-HIGH**
   - 5.1 [Calculate Derived Values During Render](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rstate-derived-values.md) — MEDIUM (eliminates sync bugs, simpler code)
   - 5.2 [Split Context to Prevent Unnecessary Re-renders](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rstate-context-optimization.md) — MEDIUM (reduces re-renders from context changes)
   - 5.3 [Use Functional State Updates for Derived Values](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rstate-functional-updates.md) — MEDIUM-HIGH
   - 5.4 [Use Lazy Initialization for Expensive Initial State](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rstate-lazy-initialization.md) — MEDIUM-HIGH
   - 5.5 [Use useReducer for Complex State Logic](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rstate-use-reducer.md) — MEDIUM (clearer state transitions, easier testing)
6. [Memoization & Performance](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/_sections.md#6-memoization--performance-memo) — **MEDIUM**
   - 6.1 [Avoid Premature Memoization](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/memo-avoid-premature.md) — MEDIUM (memoization has overhead, measure first)
   - 6.2 [Leverage React Compiler for Automatic Memoization](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/memo-compiler.md) — MEDIUM (automatic optimization, less manual code)
   - 6.3 [Use React.memo for Expensive Pure Components](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/memo-react-memo.md) — MEDIUM (skips re-render when props unchanged)
   - 6.4 [Use useCallback for Stable Function References](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/memo-use-callback.md) — MEDIUM (prevents child re-renders from reference changes)
   - 6.5 [Use useMemo for Expensive Calculations](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/memo-use-memo.md) — MEDIUM (skips expensive recalculation on re-renders)
7. [Effects & Events](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/_sections.md#7-effects--events-effect) — **MEDIUM**
   - 7.1 [Always Clean Up Effect Side Effects](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/effect-cleanup.md) — MEDIUM (prevents memory leaks, stale callbacks)
   - 7.2 [Avoid Effects for Derived State and User Events](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/effect-avoid-unnecessary.md) — MEDIUM (eliminates sync bugs, simpler code)
   - 7.3 [Avoid Object and Array Dependencies in Effects](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/effect-object-dependencies.md) — MEDIUM (prevents infinite loops, unnecessary re-runs)
   - 7.4 [Use useEffectEvent for Non-Reactive Logic](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/effect-use-effect-event.md) — MEDIUM (separates reactive from non-reactive code)
   - 7.5 [Use useSyncExternalStore for External Subscriptions](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/effect-use-sync-external-store.md) — MEDIUM (correct subscription handling, SSR compatible)
   - 7.6 [Use use(browser()) for Client-Only Rendering](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/effect-use-browser-only.md) — MEDIUM (no mounted-flag double render, React 19.3+)
8. [Component Patterns](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/_sections.md#8-component-patterns-rcomp) — **LOW-MEDIUM**
   - 8.1 [Choose Controlled vs Uncontrolled Appropriately](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rcomp-controlled-components.md) — LOW-MEDIUM
   - 8.2 [Prefer Composition Over Props Explosion](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rcomp-composition.md) — LOW-MEDIUM
   - 8.3 [Use Key to Reset Component State](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rcomp-key-reset.md) — LOW-MEDIUM
   - 8.4 [Use Render Props for Inversion of Control](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rcomp-render-props.md) — LOW-MEDIUM
   - 8.5 [Attach DOM Behavior to Siblings with Fragment Refs](https://skilld.dev/api/skills-raw/pymodel/react-frontend-skills/react/references/rcomp-fragment-refs.md) — LOW-MEDIUM (ref access to child DOM without wrapper elements; stable in 19.3)

## How to Use

Run in the project root first:

```bash
npx -y @pymodel/react-frontend-skills detect  # installed vs. targeted versions
```

Read `references/<rule-id>.md` for each rule above that matches the task: why it matters, then incorrect vs. correct code.

## References

1. [https://react.dev](https://react.dev)
2. [https://react.dev/blog/2024/12/05/react-19](https://react.dev/blog/2024/12/05/react-19)
3. [https://react.dev/blog/2025/10/01/react-19-2](https://react.dev/blog/2025/10/01/react-19-2)
4. [https://react.dev/blog/2026/09/09/react-19-3](https://react.dev/blog/2026/09/09/react-19-3)
5. [https://react.dev/learn/you-might-not-need-an-effect](https://react.dev/learn/you-might-not-need-an-effect)
6. [https://github.com/facebook/react](https://github.com/facebook/react)

## Related Skills

- For Next.js 16 App Router, see `nextjs` skill
- For client-side form handling, see `react-hook-form` skill
- For data caching with TanStack Query, see `tanstack-query` skill
