React Official Documentation

repository·main·Indexed Jun 8, 2026

https://github.com/reactjs/react.dev

The official documentation site for React, featuring guides, API references, and interactive examples. Covers modern React patterns including Hooks, Server Components, automatic batching, and streaming SSR. Includes technical details for upgrading to React 18, using Sandpack for interactive playgrounds, and implementing new APIs like createRoot and useSyncExternalStore.

Tokens
647.6K
Snippets
1.7K
Records
2K
Agent score
96%

What's inside reactjs/react.dev

  1. Overview of built-in React Hooks

    main

    React Hooks allow you to use different React features (like state, context, and lifecycle methods) from functional components. They are categorized by their primary purpose:

    • State Hooks: For remembering information like user input or UI state (useState, useReducer).
    • Context Hooks: For receiving information from distant parents without prop drilling (useContext).
    • Ref Hooks: For holding information that doesn't trigger re-renders, such as DOM nodes or timer IDs (useRef, useImperativeHandle).
    • Effect Hooks: For synchronizing with external systems like networks, browser APIs, or animations (useEffect, useLayoutEffect, useInsertionEffect, useEffectEvent).
    • Performance Hooks: For skipping unnecessary work or prioritizing UI updates (useMemo, useCallback, useTransition, useDeferredValue).
    • Other Hooks: Specialized hooks for library authors or specific use cases (useDebugValue, useId, useSyncExternalStore, useActionState).
  2. Overview of the React Compiler

    main
    The React Compiler is an automatic optimization tool that handles memoization for your React application. It eliminates the need for manual performance optimizations like useMemo, useCallback, and React.memo by automatically managing component and value memoization during the build process.
  3. Overview of built-in React APIs

    main

    Beyond Hooks and Components, the react package provides several specialized APIs for component definition and lifecycle management:

    • createContext: Defines and provides context to child components (used with useContext).
    • lazy: Defers loading a component's code until its first render.
    • memo: Allows a component to skip re-renders if its props haven't changed (used with useMemo and useCallback).
    • startTransition: Marks a state update as non-urgent to keep the UI responsive.
    • act: Used in testing to ensure all updates (renders and interactions) are processed before making assertions.
    • use: A resource API used to read values from Promises or Context.
  4. Overview of React 19.2 and Canary features

    main

    React 19.2 and Canary introduce several new capabilities for managing UI state, animations, and performance:

    React 19.2 Features

    • <Activity />: A new component used to manage UI visibility.
    • useEffectEvent: A hook to fire events from Effects without making the effect reactive to the event's data.
    • Performance Tracks: A new profiling tool available in React DevTools.
    • Partial Pre-Rendering (PPR): Allows pre-rendering parts of an application ahead of time and resuming rendering later.

    Canary Features

    • <ViewTransition />: A component for animating page transitions.
    • Fragment Refs: A new way to interact with the DOM nodes wrapped by a <Fragment>.
  5. Overview of the React Compiler

    main

    The React Compiler is a build-time tool that automatically optimizes React applications by applying memoization. It understands the Rules of React and works with plain JavaScript, eliminating the need for manual memoization using useMemo, useCallback, or React.memo in most cases.

    Key Benefits

    • Automatic Memoization: Automatically skips cascading re-renders of components and memoizes expensive calculations within components and hooks.
    • Reduced Boilerplate: Allows you to write cleaner code without the mental burden of manual dependency arrays and memoization wrappers.
    • Fine-grained Reactivity: Ensures that only the relevant parts of an application re-render when state changes.

    Supported Build Tools

    • Babel: The primary integration method via a Babel plugin.
    • Vite, Metro, and Rsbuild.
    • Next.js: Users can enable the swc-invoked React Compiler using version v15.3.1 or higher.
    • Future Support: Work is ongoing for first-class support in swc and oxc to reduce reliance on Babel.
  6. Overview of React Labs experimental projects (June 2022)

    main

    As of June 2022, the React team is actively researching several key areas to improve performance, developer experience, and server-side capabilities. Note that these are research directions and not a fixed roadmap with concrete ship dates.

    Key areas of focus include:

    • Server Components (RSC): Moving towards an async/await model for data fetching and using boundary annotations instead of file extensions.
    • Asset Loading: Developing APIs to preload and load deduplicated external assets (scripts, styles, fonts, images) that integrate with Suspense to prevent layout shifts.
    • React Optimizing Compiler: An evolution of 'React Forget' that automatically generates useMemo and useCallback equivalents to minimize re-renders.
    • Offscreen: A low-level capability to hide UI visually while deprioritizing its rendering work, allowing for features like instant transitions, reusable state, and virtualized list rendering.
    • Transition Tracing: A new version of the Interaction Tracing API (tentatively called Transition Tracing) to help developers track why specific interactions (like button clicks or navigations) are slow.
    • Static Server Rendering Optimizations: Exploring ways to optimize dynamic SSR using compilation and static passes.
  7. Overview of the React Optimizing Compiler (React Forget)

    main

    The React Optimizing Compiler (formerly referred to as React Forget) is an automatic reactivity compiler designed to reduce unnecessary re-renders.

    How it works:

    • Goal: Instead of re-rendering when object identity changes (the current behavior), the compiler aims to ensure React re-renders only when the semantic value of state changes.
    • Automatic Memoization: It automatically handles the memoization that developers currently do manually (e.g., using useMemo or useCallback) to prevent over-reactivity.
    • Integration: The primary public interface will be via Babel and other build system plugins. It uses a custom code representation and transformation pipeline to perform semantic analysis.

    This compiler is intended to keep the simple React mental model (UI as a function of state) while removing the manual performance optimization overhead.

  8. Understand the React Foundation launch and governance

    main
    The React Foundation has officially launched, hosted by the Linux Foundation. React, React Native, and supporting projects like JSX are now owned by the React Foundation, an independent foundation, rather than Meta. The foundation is governed by a board of directors composed of representatives from its eight Platinum founding members: Amazon, Callstack, Expo, Huawei, Meta, Microsoft, Software Mansion, and Vercel. Seth Webster serves as the executive director. React's technical governance remains independent from the foundation board, with technical direction set by contributors and maintainers via a provisional leadership council.
  9. Navigate the React Reference Documentation

    main

    The React reference documentation is organized into functional subsections to help you find specific APIs and guides. Use the following structure to locate the documentation you need:

  10. Understand Concurrent React in React 18

    main

    Concurrent React is a foundational update to React's core rendering model that enables React to prepare multiple versions of your UI simultaneously. Unlike synchronous rendering, where an update cannot be interrupted until the user sees the result, Concurrent React allows rendering to be interruptible.

    Key characteristics include:

    • Interruptible Rendering: React can pause, resume, or even abandon an in-progress render to keep the UI responsive to user input.
    • Consistent UI: React guarantees UI consistency by waiting to perform DOM mutations until the entire tree has been evaluated.
    • Background Preparation: React can prepare new screens in the background without blocking the main thread.
    • Reusable State: React can remove UI sections and add them back later while preserving their previous state (e.g., using an upcoming <Offscreen> component).

    Concurrent React is opt-in: it is only enabled in parts of your application that use specific concurrent features like startTransition, useDeferredValue, or Suspense.

  11. Start learning React with the new react.dev documentation

    main
    The new React documentation at react.dev teaches modern React using function components and Hooks from the beginning. The site is organized into two main sections: Learn React (a self-paced course) and API Reference (detailed API documentation). The previous documentation has been archived at legacy.reactjs.org.
  12. Set up the react.dev documentation environment

    main
    This repository contains the source code for react.dev, the official React documentation website. It is built with Next.js 15.1.11 and React 19, using MDX for documentation content. Developers use this project to contribute to React documentation, fix errors, or add new guides.