diff --git a/public/images/docs/diagrams/19_2_batching_after.dark.png b/public/images/docs/diagrams/19_2_batching_after.dark.png
new file mode 100644
index 000000000..29ff14093
Binary files /dev/null and b/public/images/docs/diagrams/19_2_batching_after.dark.png differ
diff --git a/public/images/docs/diagrams/19_2_batching_after.png b/public/images/docs/diagrams/19_2_batching_after.png
new file mode 100644
index 000000000..0ae652f79
Binary files /dev/null and b/public/images/docs/diagrams/19_2_batching_after.png differ
diff --git a/public/images/docs/diagrams/19_2_batching_before.dark.png b/public/images/docs/diagrams/19_2_batching_before.dark.png
new file mode 100644
index 000000000..758afceb1
Binary files /dev/null and b/public/images/docs/diagrams/19_2_batching_before.dark.png differ
diff --git a/public/images/docs/diagrams/19_2_batching_before.png b/public/images/docs/diagrams/19_2_batching_before.png
new file mode 100644
index 000000000..7e260135f
Binary files /dev/null and b/public/images/docs/diagrams/19_2_batching_before.png differ
diff --git a/public/images/docs/performance-tracks/changed-props.dark.png b/public/images/docs/performance-tracks/changed-props.dark.png
new file mode 100644
index 000000000..6709a7ea8
Binary files /dev/null and b/public/images/docs/performance-tracks/changed-props.dark.png differ
diff --git a/public/images/docs/performance-tracks/changed-props.png b/public/images/docs/performance-tracks/changed-props.png
new file mode 100644
index 000000000..33efe9289
Binary files /dev/null and b/public/images/docs/performance-tracks/changed-props.png differ
diff --git a/public/images/docs/performance-tracks/components-effects.dark.png b/public/images/docs/performance-tracks/components-effects.dark.png
new file mode 100644
index 000000000..57e3a30b0
Binary files /dev/null and b/public/images/docs/performance-tracks/components-effects.dark.png differ
diff --git a/public/images/docs/performance-tracks/components-effects.png b/public/images/docs/performance-tracks/components-effects.png
new file mode 100644
index 000000000..ff315b99d
Binary files /dev/null and b/public/images/docs/performance-tracks/components-effects.png differ
diff --git a/public/images/docs/performance-tracks/components-render.dark.png b/public/images/docs/performance-tracks/components-render.dark.png
new file mode 100644
index 000000000..c0608b153
Binary files /dev/null and b/public/images/docs/performance-tracks/components-render.dark.png differ
diff --git a/public/images/docs/performance-tracks/components-render.png b/public/images/docs/performance-tracks/components-render.png
new file mode 100644
index 000000000..436737767
Binary files /dev/null and b/public/images/docs/performance-tracks/components-render.png differ
diff --git a/public/images/docs/performance-tracks/overview.dark.png b/public/images/docs/performance-tracks/overview.dark.png
new file mode 100644
index 000000000..07513fe90
Binary files /dev/null and b/public/images/docs/performance-tracks/overview.dark.png differ
diff --git a/public/images/docs/performance-tracks/overview.png b/public/images/docs/performance-tracks/overview.png
new file mode 100644
index 000000000..835a247cf
Binary files /dev/null and b/public/images/docs/performance-tracks/overview.png differ
diff --git a/public/images/docs/performance-tracks/scheduler-cascading-update.dark.png b/public/images/docs/performance-tracks/scheduler-cascading-update.dark.png
new file mode 100644
index 000000000..beb4512d2
Binary files /dev/null and b/public/images/docs/performance-tracks/scheduler-cascading-update.dark.png differ
diff --git a/public/images/docs/performance-tracks/scheduler-cascading-update.png b/public/images/docs/performance-tracks/scheduler-cascading-update.png
new file mode 100644
index 000000000..8631c4896
Binary files /dev/null and b/public/images/docs/performance-tracks/scheduler-cascading-update.png differ
diff --git a/public/images/docs/performance-tracks/scheduler-update.dark.png b/public/images/docs/performance-tracks/scheduler-update.dark.png
new file mode 100644
index 000000000..df252663a
Binary files /dev/null and b/public/images/docs/performance-tracks/scheduler-update.dark.png differ
diff --git a/public/images/docs/performance-tracks/scheduler-update.png b/public/images/docs/performance-tracks/scheduler-update.png
new file mode 100644
index 000000000..79a361d2a
Binary files /dev/null and b/public/images/docs/performance-tracks/scheduler-update.png differ
diff --git a/public/images/docs/performance-tracks/scheduler.dark.png b/public/images/docs/performance-tracks/scheduler.dark.png
new file mode 100644
index 000000000..7e48020f8
Binary files /dev/null and b/public/images/docs/performance-tracks/scheduler.dark.png differ
diff --git a/public/images/docs/performance-tracks/scheduler.png b/public/images/docs/performance-tracks/scheduler.png
new file mode 100644
index 000000000..1cd07a144
Binary files /dev/null and b/public/images/docs/performance-tracks/scheduler.png differ
diff --git a/public/images/docs/performance-tracks/server-overview.dark.png b/public/images/docs/performance-tracks/server-overview.dark.png
new file mode 100644
index 000000000..221fb1204
Binary files /dev/null and b/public/images/docs/performance-tracks/server-overview.dark.png differ
diff --git a/public/images/docs/performance-tracks/server-overview.png b/public/images/docs/performance-tracks/server-overview.png
new file mode 100644
index 000000000..85c7eed27
Binary files /dev/null and b/public/images/docs/performance-tracks/server-overview.png differ
diff --git a/src/components/Layout/Sidebar/SidebarLink.tsx b/src/components/Layout/Sidebar/SidebarLink.tsx
index 5c01fefc3..9650e95fa 100644
--- a/src/components/Layout/Sidebar/SidebarLink.tsx
+++ b/src/components/Layout/Sidebar/SidebarLink.tsx
@@ -24,7 +24,7 @@ interface SidebarLinkProps {
selected?: boolean;
title: string;
level: number;
- version?: 'canary' | 'major' | 'experimental';
+ version?: 'canary' | 'major' | 'experimental' | 'rc';
icon?: React.ReactNode;
isExpanded?: boolean;
hideArrow?: boolean;
@@ -102,6 +102,12 @@ export function SidebarLink({
className="ms-1 text-gray-30 dark:text-gray-60 inline-block w-3.5 h-3.5 align-[-3px]"
/>
)}
+ {version === 'rc' && (
+
+ )}
{isExpanded != null && !hideArrow && (
diff --git a/src/components/MDX/ExpandableCallout.tsx b/src/components/MDX/ExpandableCallout.tsx
index 35f4e13e6..8ce07d0bd 100644
--- a/src/components/MDX/ExpandableCallout.tsx
+++ b/src/components/MDX/ExpandableCallout.tsx
@@ -24,6 +24,7 @@ type CalloutVariants =
| 'wip'
| 'canary'
| 'experimental'
+ | 'rc'
| 'major'
| 'rsc';
@@ -50,6 +51,15 @@ const variantMap = {
overlayGradient:
'linear-gradient(rgba(245, 249, 248, 0), rgba(245, 249, 248, 1)',
},
+ rc: {
+ title: 'RC',
+ Icon: IconCanary,
+ containerClasses:
+ 'bg-gray-5 dark:bg-gray-60 dark:bg-opacity-20 text-primary dark:text-primary-dark text-lg',
+ textColor: 'text-gray-60 dark:text-gray-30',
+ overlayGradient:
+ 'linear-gradient(rgba(245, 249, 248, 0), rgba(245, 249, 248, 1)',
+ },
canary: {
title: 'نسخه آزمایشی',
Icon: IconCanary,
diff --git a/src/components/MDX/MDXComponents.tsx b/src/components/MDX/MDXComponents.tsx
index ef377f008..b03097b10 100644
--- a/src/components/MDX/MDXComponents.tsx
+++ b/src/components/MDX/MDXComponents.tsx
@@ -106,6 +106,10 @@ const Canary = ({children}: {children: React.ReactNode}) => (
{children}
);
+const RC = ({children}: {children: React.ReactNode}) => (
+ {children}
+);
+
const Experimental = ({children}: {children: React.ReactNode}) => (
{children}
);
@@ -533,6 +537,7 @@ export const MDXComponents = {
Math,
MathI,
Note,
+ RC,
Canary,
Experimental,
ExperimentalBadge,
diff --git a/src/components/MDX/Sandpack/template.ts b/src/components/MDX/Sandpack/template.ts
index 358c8616e..ed594887b 100644
--- a/src/components/MDX/Sandpack/template.ts
+++ b/src/components/MDX/Sandpack/template.ts
@@ -35,8 +35,8 @@ root.render(
eject: 'react-scripts eject',
},
dependencies: {
- react: '^19.1.0',
- 'react-dom': '^19.1.0',
+ react: '^19.2.0',
+ 'react-dom': '^19.2.0',
'react-scripts': '^5.0.0',
},
},
diff --git a/src/components/MDX/SandpackWithHTMLOutput.tsx b/src/components/MDX/SandpackWithHTMLOutput.tsx
index c5149deb9..49e980d32 100644
--- a/src/components/MDX/SandpackWithHTMLOutput.tsx
+++ b/src/components/MDX/SandpackWithHTMLOutput.tsx
@@ -56,8 +56,8 @@ export default function formatHTML(markup) {
const packageJSON = `
{
"dependencies": {
- "react": "18.3.0-canary-6db7f4209-20231021",
- "react-dom": "18.3.0-canary-6db7f4209-20231021",
+ "react": "^19.2.0",
+ "react-dom": "^19.2.0",
"react-scripts": "^5.0.0",
"html-format": "^1.1.2"
},
diff --git a/src/components/PageHeading.tsx b/src/components/PageHeading.tsx
index 760542750..ee92f5e55 100644
--- a/src/components/PageHeading.tsx
+++ b/src/components/PageHeading.tsx
@@ -19,7 +19,7 @@ import {IconExperimental} from './Icon/IconExperimental';
interface PageHeadingProps {
title: string;
- version?: 'experimental' | 'canary';
+ version?: 'experimental' | 'canary' | 'rc';
experimental?: boolean;
status?: string;
description?: string;
@@ -46,6 +46,12 @@ function PageHeading({
className="ms-4 mt-1 text-gray-50 dark:text-gray-40 inline-block w-6 h-6 align-[-1px]"
/>
)}
+ {version === 'rc' && (
+
+ )}
{version === 'experimental' && (
>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
To install:
npm
+<<<<<<< HEAD
{`npm install --save-dev eslint-plugin-react-hooks@rc`}
+=======
+{`npm install --save-dev eslint-plugin-react-hooks@^6.1.1`}
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
pnpm
+<<<<<<< HEAD
{`pnpm add --save-dev eslint-plugin-react-hooks@rc`}
+=======
+{`pnpm add --save-dev eslint-plugin-react-hooks@^6.1.1`}
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
yarn
+<<<<<<< HEAD
{`yarn add --dev eslint-plugin-react-hooks@rc`}
+=======
+{`yarn add --dev eslint-plugin-react-hooks@^6.1.1`}
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
```js
diff --git a/src/content/blog/2025/04/23/react-labs-view-transitions-activity-and-more.md b/src/content/blog/2025/04/23/react-labs-view-transitions-activity-and-more.md
index c7f740091..41c359807 100644
--- a/src/content/blog/2025/04/23/react-labs-view-transitions-activity-and-more.md
+++ b/src/content/blog/2025/04/23/react-labs-view-transitions-activity-and-more.md
@@ -18,11 +18,9 @@ In React Labs posts, we write about projects in active research and development.
-React Conf 2025 is scheduled for October 7–8 in Henderson, Nevada!
+React Conf 2025 is scheduled for October 7–8 in Henderson, Nevada!
-We're looking for speakers to help us create talks about the features covered in this post. If you're interested in speaking at ReactConf, [please apply here](https://forms.reform.app/react-conf/call-for-speakers/) (no talk proposal required).
-
-For more info on tickets, free streaming, sponsoring, and more, see [the React Conf website](https://conf.react.dev).
+Watch the livestream on [the React Conf website](https://conf.react.dev).
@@ -11544,7 +11542,7 @@ Try searching for a video, selecting it, and clicking "back":
```js src/App.js
-import { unstable_ViewTransition as ViewTransition, unstable_Activity as Activity } from "react"; import Details from "./Details"; import Home from "./Home"; import { useRouter } from "./router";
+import { unstable_ViewTransition as ViewTransition } from "react"; import Details from "./Details"; import Home from "./Home"; import { useRouter } from "./router"; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;
export default function App() {
const { url } = useRouter();
@@ -12881,7 +12879,7 @@ With this update, if the content on the next page has time to pre-render, it wil
```js src/App.js
-import { unstable_ViewTransition as ViewTransition, unstable_Activity as Activity, use } from "react"; import Details from "./Details"; import Home from "./Home"; import { useRouter } from "./router"; import {fetchVideos} from './data'
+import { unstable_ViewTransition as ViewTransition, use } from "react"; import Details from "./Details"; import Home from "./Home"; import { useRouter } from "./router"; import {fetchVideos} from './data'; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;
export default function App() {
const { url } = useRouter();
@@ -14303,7 +14301,7 @@ useEffect(() => {
}); // compiler inserted dependencies.
```
-With this code, the React Compiler can infer the dependencies for you and insert them automatically so you don't need to see or write them. With features like [the IDE extension](#compiler-ide-extension) and [`useEffectEvent`](/reference/react/experimental_useEffectEvent), we can provide a CodeLens to show you what the Compiler inserted for times you need to debug, or to optimize by removing a dependency. This helps reinforce the correct mental model for writing Effects, which can run at any time to synchronize your component or hook's state with something else.
+With this code, the React Compiler can infer the dependencies for you and insert them automatically so you don't need to see or write them. With features like [the IDE extension](#compiler-ide-extension) and [`useEffectEvent`](/reference/react/useEffectEvent), we can provide a CodeLens to show you what the Compiler inserted for times you need to debug, or to optimize by removing a dependency. This helps reinforce the correct mental model for writing Effects, which can run at any time to synchronize your component or hook's state with something else.
Our hope is that automatically inserting dependencies is not only easier to write, but that it also makes them easier to understand by forcing you to think in terms of what the Effect does, and not in component lifecycles.
diff --git a/src/content/blog/2025/10/01/react-19-2.md b/src/content/blog/2025/10/01/react-19-2.md
new file mode 100644
index 000000000..eae9c8fa7
--- /dev/null
+++ b/src/content/blog/2025/10/01/react-19-2.md
@@ -0,0 +1,339 @@
+---
+title: "React 19.2"
+author: The React Team
+date: 2025/10/01
+description: React 19.2 adds new features like Activity, React Performance Tracks, useEffectEvent, and more.
+---
+
+October 1, 2025 by [The React Team](/community/team)
+
+---
+
+
+
+React 19.2 is now available on npm!
+
+
+
+This is our third release in the last year, following React 19 in December and React 19.1 in June. In this post, we'll give an overview of the new features in React 19.2, and highlight some notable changes.
+
+
+
+---
+
+## New React Features {/*new-react-features*/}
+
+### `` {/*activity*/}
+
+`` lets you break your app into "activities" that can be controlled and prioritized.
+
+You can use Activity as an alternative to conditionally rendering parts of your app:
+
+```js
+// Before
+{isVisible && }
+
+// After
+
+
+
+```
+
+In React 19.2, Activity supports two modes: `visible` and `hidden`.
+
+- `hidden`: hides the children, unmounts effects, and defers all updates until React has nothing left to work on.
+- `visible`: shows the children, mounts effects, and allows updates to be processed normally.
+
+This means you can pre-render and keep rendering hidden parts of the app without impacting the performance of anything visible on screen.
+
+You can use Activity to render hidden parts of the app that a user is likely to navigate to next, or to save the state of parts the user navigates away from. This helps make navigations quicker by loading data, css, and images in the background, and allows back navigations to maintain state such as input fields.
+
+In the future, we plan to add more modes to Activity for different use cases.
+
+For examples on how to use Activity, check out the [Activity docs](/reference/react/Activity).
+
+---
+
+### `useEffectEvent` {/*use-effect-event*/}
+
+One common pattern with `useEffect` is to notify the app code about some kind of "events" from an external system. For example, when a chat room gets connected, you might want to display a notification:
+
+```js {5,11}
+function ChatRoom({ roomId, theme }) {
+ useEffect(() => {
+ const connection = createConnection(serverUrl, roomId);
+ connection.on('connected', () => {
+ showNotification('Connected!', theme);
+ });
+ connection.connect();
+ return () => {
+ connection.disconnect()
+ };
+ }, [roomId, theme]);
+ // ...
+```
+
+The problem with the code above is that a change to any values used inside such an "event" will cause the surrounding Effect to re-run. For example, changing the `theme` will cause the chat room to reconnect. This makes sense for values related to the Effect logic itself, like `roomId`, but it doesn't make sense for `theme`.
+
+To solve this, most users just disable the lint rule and exclude the dependency. But that can lead to bugs since the linter can no longer help you keep the dependencies up to date if you need to update the Effect later.
+
+With `useEffectEvent`, you can split the "event" part of this logic out of the Effect that emits it:
+
+```js {2,3,4,9}
+function ChatRoom({ roomId, theme }) {
+ const onConnected = useEffectEvent(() => {
+ showNotification('Connected!', theme);
+ });
+
+ useEffect(() => {
+ const connection = createConnection(serverUrl, roomId);
+ connection.on('connected', () => {
+ onConnected();
+ });
+ connection.connect();
+ return () => connection.disconnect();
+ }, [roomId]); // ✅ All dependencies declared (Effect Events aren't dependencies)
+ // ...
+```
+
+Similar to DOM events, Effect Events always “see” the latest props and state.
+
+**Effect Events should _not_ be declared in the dependency array**. You'll need to upgrade to `eslint-plugin-react-hooks@6.1.1` so that the linter doesn't try to insert them as dependencies. Note that Effect Events can only be declared in the same component or Hook as "their" Effect. These restrictions are verified by the linter.
+
+
+
+#### When to use `useEffectEvent` {/*when-to-use-useeffectevent*/}
+
+You should use `useEffectEvent` for functions that are conceptually "events" that happen to be fired from an Effect instead of a user event (that's what makes it an "Effect Event"). You don't need to wrap everything in `useEffectEvent`, or to use it just to silence the lint error, as this can lead to bugs.
+
+For a deep dive on how to think about Event Effects, see: [Separating Events from Effects](/learn/separating-events-from-effects#extracting-non-reactive-logic-out-of-effects).
+
+
+
+---
+
+### `cacheSignal` {/*cache-signal*/}
+
+
+
+`cacheSignal` is only for use with [React Server Components](/reference/rsc/server-components).
+
+
+
+`cacheSignal` allows you to know when the [`cache()`](/reference/react/cache) lifetime is over:
+
+```
+import {cache, cacheSignal} from 'react';
+const dedupedFetch = cache(fetch);
+
+async function Component() {
+ await dedupedFetch(url, { signal: cacheSignal() });
+}
+```
+
+This allows you to clean up or abort work when the result will no longer be used in the cache, such as:
+
+- React has successfully completed rendering
+- The render was aborted
+- The render has failed
+
+For more info, see the [`cacheSignal` docs](/reference/react/cacheSignal).
+
+---
+
+### Performance Tracks {/*performance-tracks*/}
+
+React 19.2 adds a new set of [custom tracks](https://developer.chrome.com/docs/devtools/performance/extension) to Chrome DevTools performance profiles to provide more information about the performance of your React app:
+
+
+
+
+
+
+
+
+
+
+
+
+The [React Performance Tracks docs](/reference/dev-tools/react-performance-tracks) explain everything included in the tracks, but here is a high-level overview.
+
+#### Scheduler ⚛ {/*scheduler-*/}
+
+The Scheduler track shows what React is working on for different priorities such as "blocking" for user interactions, or "transition" for updates inside startTransition. Inside each track, you will see the type of work being performed such as the event that scheduled an update, and when the render for that update happened.
+
+We also show information such as when an update is blocked waiting for a different priority, or when React is waiting for paint before continuing. The Scheduler track helps you understand how React splits your code into different priorities, and the order it completed the work.
+
+See the [Scheduler track](/reference/dev-tools/react-performance-tracks#scheduler) docs to see everything included.
+
+#### Components ⚛ {/*components-*/}
+
+The Components track shows the tree of components that React is working on either to render or run effects. Inside you'll see labels such as "Mount" for when children mount or effects are mounted, or "Blocked" for when rendering is blocked due to yielding to work outside React.
+
+The Component track helps you understand when components are rendered or run effects, and the time it takes to complete that work to help identify performance problems.
+
+See the [Component track docs](/reference/dev-tools/react-performance-tracks#components) for see everything included.
+
+---
+
+## New React DOM Features {/*new-react-dom-features*/}
+
+### Partial Pre-rendering {/*partial-pre-rendering*/}
+
+In 19.2 we're adding a new capability to pre-render part of the app ahead of time, and resume rendering it later.
+
+This feature is called "Partial Pre-rendering", and allows you to pre-render the static parts of your app and serve it from a CDN, and then resume rendering the shell to fill it in with dynamic content later.
+
+To pre-render an app to resume later, first call `prerender` with an `AbortController`:
+
+```
+const {prelude, postponed} = await prerender(, {
+ signal: controller.signal,
+});
+
+// Save the postponed state for later
+await savePostponedState(postponed);
+
+// Send prelude to client or CDN.
+```
+
+Then, you can return the `prelude` shell to the client, and later call `resume` to "resume" to a SSR stream:
+
+```
+const postponed = await getPostponedState(request);
+const resumeStream = await resume(, postponed);
+
+// Send stream to client.
+```
+
+Or you can call `resumeAndPrerender` to resume to get static HTML for SSG:
+
+```
+const postponedState = await getPostponedState(request);
+const { prelude } = await resumeAndPrerender(, postponedState);
+
+// Send complete HTML prelude to CDN.
+```
+
+For more info, see the docs for the new APIs:
+- `react-dom/server`
+ - [`resume`](/reference/react-dom/server/resume): for Web Streams.
+ - [`resumeToPipeableStream`](/reference/react-dom/server/resumeToPipeableStream) for Node Streams.
+- `react-dom/static`
+ - [`resumeAndPrerender`](/reference/react-dom/static/resumeAndPrerender) for Web Streams.
+ - [`resumeAndPrerenderToNodeStream`](/reference/react-dom/static/resumeAndPrerenderToNodeStream) for Node Streams.
+
+Additionally, the prerender apis now return a `postpone` state to pass to the `resume` apis.
+
+---
+
+## Notable Changes {/*notable-changes*/}
+
+### Batching Suspense Boundaries for SSR {/*batching-suspense-boundaries-for-ssr*/}
+
+We fixed a behavioral bug where Suspense boundaries would reveal differently depending on if they were rendered on the client or when streaming from server-side rendering.
+
+Starting in 19.2, React will batch reveals of server-rendered Suspense boundaries for a short time, to allow more content to be revealed together and align with the client-rendered behavior.
+
+
+
+Previously, during streaming server-side rendering, suspense content would immediately replace fallbacks.
+
+
+
+
+
+In React 19.2, suspense boundaries are batched for a small amount of time, to allow revealing more content together.
+
+
+
+This fix also prepares apps for supporting `` for Suspense during SSR. By revealing more content together, animations can run in larger batches of content, and avoid chaining animations of content that stream in close together.
+
+
+
+React uses heuristics to ensure throttling does not impact core web vitals and search ranking.
+
+For example, if the total page load time is approaching 2.5s (which is the time considered "good" for [LCP](https://web.dev/articles/lcp)), React will stop batching and reveal content immediately so that the throttling is not the reason to miss the metric.
+
+
+
+---
+
+### SSR: Web Streams support for Node {/*ssr-web-streams-support-for-node*/}
+
+React 19.2 adds support for Web Streams for streaming SSR in Node.js:
+- [`renderToReadableStream`](/reference/react-dom/server/renderToReadableStream) is now available for Node.js
+- [`prerender`](/reference/react-dom/static/prerender) is now available for Node.js
+
+As well as the new `resume` APIs:
+- [`resume`](/reference/react-dom/server/resume) is available for Node.js.
+- [`resumeAndPrerender`](/reference/react-dom/static/resumeAndPrerender) is available for Node.js.
+
+
+
+
+#### Prefer Node Streams for server-side rendering in Node.js {/*prefer-node-streams-for-server-side-rendering-in-nodejs*/}
+
+In Node.js environments, we still highly recommend using the Node Streams APIs:
+
+- [`renderToPipeableStream`](/reference/react-dom/server/renderToPipeableStream)
+- [`resumeToPipeableStream`](/reference/react-dom/server/resumeToPipeableStream)
+- [`prerenderToNodeStream`](/reference/react-dom/static/prerenderToNodeStream)
+- [`resumeAndPrerenderToNodeStream`](/reference/react-dom/static/resumeAndPrerenderToNodeStream)
+
+This is because Node Streams are much faster than Web Streams in Node, and Web Streams do not support compression by default, leading to users accidentally missing the benefits of streaming.
+
+
+
+---
+
+### `eslint-plugin-react-hooks` v6 {/*eslint-plugin-react-hooks*/}
+
+We also published `eslint-plugin-react-hooks@6.1.1` with flat config by default in the `recommended` preset, and opt-in for new React Compiler powered rules.
+
+To continue using the legacy config, you can change to `recommended-legacy`:
+
+```diff
+- extends: ['plugin:react-hooks/recommended']
++ extends: ['plugin:react-hooks/recommended-legacy']
+```
+
+For a full list of compiler enabled rules, [check out the linter docs](/reference/eslint-plugin-react-hooks#additional-rules).
+
+Check out the `eslint-plugin-react-hooks` [changelog for a full list of changes](https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/CHANGELOG.md#610).
+
+---
+
+### Update the default `useId` prefix {/*update-the-default-useid-prefix*/}
+
+In 19.2, we're updating the default `useId` prefix from `:r:` (19.0.0) or `«r»` (19.1.0) to `_r_`.
+
+The original intent of using a special character that was not valid for CSS selectors was that it would be unlikely to collide with IDs written by users. However, to support View Transitions, we need to ensure that IDs generated by `useId` are valid for `view-transition-name` and XML 1.0 names.
+
+---
+
+## Changelog {/*changelog*/}
+
+Other notable changes
+- `react-dom`: Allow nonce to be used on hoistable styles [#32461](https://github.com/facebook/react/pull/32461)
+- `react-dom`: Warn for using a React owned node as a Container if it also has text content [#32774](https://github.com/facebook/react/pull/32774)
+
+Notable bug fixes
+- `react`: Stringify context as "SomeContext" instead of "SomeContext.Provider" [#33507](https://github.com/facebook/react/pull/33507)
+- `react`: Fix infinite useDeferredValue loop in popstate event [#32821](https://github.com/facebook/react/pull/32821)
+- `react`: Fix a bug when an initial value was passed to useDeferredValue [#34376](https://github.com/facebook/react/pull/34376)
+- `react`: Fix a crash when submitting forms with Client Actions [#33055](https://github.com/facebook/react/pull/33055)
+- `react`: Hide/unhide the content of dehydrated suspense boundaries if they resuspend [#32900](https://github.com/facebook/react/pull/32900)
+- `react`: Avoid stack overflow on wide trees during Hot Reload [#34145](https://github.com/facebook/react/pull/34145)
+- `react`: Improve component stacks in various places [#33629](https://github.com/facebook/react/pull/33629), [#33724](https://github.com/facebook/react/pull/33724), [#32735](https://github.com/facebook/react/pull/32735), [#33723](https://github.com/facebook/react/pull/33723)
+- `react`: Fix a bug with React.use inside React.lazy-ed Component [#33941](https://github.com/facebook/react/pull/33941)
+- `react-dom`: Stop warning when ARIA 1.3 attributes are used [#34264](https://github.com/facebook/react/pull/34264)
+- `react-dom`: Fix a bug with deeply nested Suspense inside Suspense fallbacks [#33467](https://github.com/facebook/react/pull/33467)
+- `react-dom`: Avoid hanging when suspending after aborting while rendering [#34192](https://github.com/facebook/react/pull/34192)
+
+For a full list of changes, please see the [Changelog](https://github.com/facebook/react/blob/main/CHANGELOG.md).
+
+
+---
+
+_Thanks to [Ricky Hanlon](https://bsky.app/profile/ricky.fm) for [writing this post](https://www.youtube.com/shorts/T9X3YkgZRG0), [Dan Abramov](https://bsky.app/profile/danabra.mov), [Matt Carroll](https://twitter.com/mattcarrollcode), [Jack Pope](https://jackpope.me), and [Joe Savona](https://x.com/en_JS) for reviewing this post._
diff --git a/src/content/blog/index.md b/src/content/blog/index.md
index a7a897634..0477bb0cc 100644
--- a/src/content/blog/index.md
+++ b/src/content/blog/index.md
@@ -12,6 +12,12 @@ You can also follow the [@react.dev](https://bsky.app/profile/react.dev) account
+
+
+React 19.2 adds new features like Activity, React Performance Tracks, useEffectEvent, and more. In this post ...
+
+
+
In React Labs posts, we write about projects in active research and development. In this post, we're sharing two new experimental features that are ready to try today, and sharing other areas we're working on now ...
diff --git a/src/content/learn/add-react-to-an-existing-project.md b/src/content/learn/add-react-to-an-existing-project.md
index 2848fc072..09af9785d 100644
--- a/src/content/learn/add-react-to-an-existing-project.md
+++ b/src/content/learn/add-react-to-an-existing-project.md
@@ -24,7 +24,11 @@ title: اضافه کردن ریاکت به یک پروژه موجود
2. **`/some-app` را بهعنوان *مسیر پایه*** در پیکربندی فریمورک خود مشخص کنید (راهنما: [Next.js](https://nextjs.org/docs/app/api-reference/config/next-config-js/basePath)، [Gatsby](https://www.gatsbyjs.com/docs/how-to/previews-deploys-hosting/path-prefix/)).
3. **سرور یا پروکسی خود را پیکربندی کنید** تا همه درخواستهای زیر مسیر `/some-app/` توسط اپلیکیشن ریاکت شما مدیریت شوند.
+<<<<<<< HEAD
این کار باعث میشود بخش React اپلیکیشن شما بتواند از [بهترین شیوهها](/learn/build-a-react-app-from-scratch#consider-using-a-framework) که در این فریمورکها تعبیه شدهاند، بهرهمند شود.
+=======
+This ensures the React part of your app can [benefit from the best practices](/learn/build-a-react-app-from-scratch#consider-using-a-framework) baked into those frameworks.
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
بسیاری از فریمورکهای مبتنی بر ریاکت فولاستک هستند و به اپلیکیشن ریاکت شما اجازه میدهند از قابلیتهای سرور استفاده کند. با این حال، حتی اگر نتوانید یا نخواهید جاوااسکریپت را روی سرور اجرا کنید، میتوانید از همان رویکرد استفاده کنید. در این حالت، خروجی HTML/CSS/JS را (خروجی [`next export`](https://nextjs.org/docs/advanced-features/static-html-export) در Next.js یا حالت پیشفرض در Gatsby) در مسیر `/some-app/` سرو کنید.
diff --git a/src/content/learn/escape-hatches.md b/src/content/learn/escape-hatches.md
index 0b2d595b2..ab5f666ad 100644
--- a/src/content/learn/escape-hatches.md
+++ b/src/content/learn/escape-hatches.md
@@ -312,12 +312,6 @@ Read **[Lifecycle of Reactive Events](/learn/lifecycle-of-reactive-effects)** to
## Separating events from Effects {/*separating-events-from-effects*/}
-
-
-This section describes an **experimental API that has not yet been released** in a stable version of React.
-
-
-
Event handlers only re-run when you perform the same interaction again. Unlike event handlers, Effects re-synchronize if any of the values they read, like props or state, are different than during last render. Sometimes, you want a mix of both behaviors: an Effect that re-runs in response to some values but not others.
All code inside Effects is *reactive.* It will run again if some reactive value it reads has changed due to a re-render. For example, this Effect will re-connect to the chat if either `roomId` or `theme` have changed:
@@ -455,8 +449,8 @@ This is not ideal. You want to re-connect to the chat only if the `roomId` has c
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "latest",
+ "react-dom": "latest",
"react-scripts": "latest",
"toastify-js": "1.12.0"
},
@@ -471,7 +465,7 @@ This is not ideal. You want to re-connect to the chat only if the `roomId` has c
```js
import { useState, useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
import { createConnection, sendMessage } from './chat.js';
import { showNotification } from './notifications.js';
diff --git a/src/content/learn/react-compiler/installation.md b/src/content/learn/react-compiler/installation.md
index a40b1f5af..536520221 100644
--- a/src/content/learn/react-compiler/installation.md
+++ b/src/content/learn/react-compiler/installation.md
@@ -173,10 +173,17 @@ React Compiler includes an ESLint rule that helps identify code that can't be op
Install the ESLint plugin:
+<<<<<<< HEAD
npm install -D eslint-plugin-react-hooks@rc
If you haven't already configured eslint-plugin-react-hooks, follow the [installation instructions in the readme](https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/README.md#installation). The compiler rule is enabled by default in the latest RC, so no additional configuration is needed.
+=======
+npm install -D eslint-plugin-react-hooks@^6.1.1
+
+
+If you haven't already configured eslint-plugin-react-hooks, follow the [installation instructions in the readme](https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/README.md#installation). The compiler rules are available in the `recommended-latest` preset.
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
The ESLint rule will:
- Identify violations of the [Rules of React](/reference/rules)
@@ -246,4 +253,8 @@ Now that you have React Compiler installed, learn more about:
- [Configuration options](/reference/react-compiler/configuration) to customize the compiler
- [Incremental adoption strategies](/learn/react-compiler/incremental-adoption) for existing codebases
- [Debugging techniques](/learn/react-compiler/debugging) for troubleshooting issues
-- [Compiling Libraries guide](/reference/react-compiler/compiling-libraries) for compiling your React library
\ No newline at end of file
+<<<<<<< HEAD
+- [Compiling Libraries guide](/reference/react-compiler/compiling-libraries) for compiling your React library
+=======
+- [Compiling Libraries guide](/reference/react-compiler/compiling-libraries) for compiling your React library
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
diff --git a/src/content/learn/removing-effect-dependencies.md b/src/content/learn/removing-effect-dependencies.md
index 7ab6dbc1f..61eb2e8d6 100644
--- a/src/content/learn/removing-effect-dependencies.md
+++ b/src/content/learn/removing-effect-dependencies.md
@@ -609,12 +609,6 @@ function ChatRoom({ roomId }) {
### Do you want to read a value without "reacting" to its changes? {/*do-you-want-to-read-a-value-without-reacting-to-its-changes*/}
-
-
-This section describes an **experimental API that has not yet been released** in a stable version of React.
-
-
-
Suppose that you want to play a sound when the user receives a new message unless `isMuted` is `true`:
```js {3,10-12}
@@ -1259,25 +1253,9 @@ Is there a line of code inside the Effect that should not be reactive? How can y
-```json package.json hidden
-{
- "dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
- "react-scripts": "latest"
- },
- "scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test --env=jsdom",
- "eject": "react-scripts eject"
- }
-}
-```
-
```js
import { useState, useEffect, useRef } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
import { FadeInAnimation } from './animation.js';
function Welcome({ duration }) {
@@ -1386,26 +1364,10 @@ Your Effect needs to read the latest value of `duration`, but you don't want it
-```json package.json hidden
-{
- "dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
- "react-scripts": "latest"
- },
- "scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test --env=jsdom",
- "eject": "react-scripts eject"
- }
-}
-```
-
```js
import { useState, useEffect, useRef } from 'react';
import { FadeInAnimation } from './animation.js';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
function Welcome({ duration }) {
const ref = useRef(null);
@@ -1825,8 +1787,8 @@ Another of these functions only exists to pass some state to an imported API met
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "latest",
+ "react-dom": "latest",
"react-scripts": "latest",
"toastify-js": "1.12.0"
},
@@ -1907,7 +1869,7 @@ export default function App() {
```js src/ChatRoom.js active
import { useState, useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
export default function ChatRoom({ roomId, createConnection, onMessage }) {
useEffect(() => {
@@ -2120,8 +2082,8 @@ As a result, the chat re-connects only when something meaningful (`roomId` or `i
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "latest",
+ "react-dom": "latest",
"react-scripts": "latest",
"toastify-js": "1.12.0"
},
@@ -2189,7 +2151,7 @@ export default function App() {
```js src/ChatRoom.js active
import { useState, useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
import {
createEncryptedConnection,
createUnencryptedConnection,
diff --git a/src/content/learn/reusing-logic-with-custom-hooks.md b/src/content/learn/reusing-logic-with-custom-hooks.md
index de68dd190..47a4cf52a 100644
--- a/src/content/learn/reusing-logic-with-custom-hooks.md
+++ b/src/content/learn/reusing-logic-with-custom-hooks.md
@@ -837,12 +837,6 @@ Every time your `ChatRoom` component re-renders, it passes the latest `roomId` a
### Passing event handlers to custom Hooks {/*passing-event-handlers-to-custom-hooks*/}
-
-
-This section describes an **experimental API that has not yet been released** in a stable version of React.
-
-
-
As you start using `useChatRoom` in more components, you might want to let components customize its behavior. For example, currently, the logic for what to do when a message arrives is hardcoded inside the Hook:
```js {9-11}
@@ -985,7 +979,7 @@ export default function ChatRoom({ roomId }) {
```js src/useChatRoom.js
import { useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
import { createConnection } from './chat.js';
export function useChatRoom({ serverUrl, roomId, onReceiveMessage }) {
@@ -1070,8 +1064,8 @@ export function showNotification(message, theme = 'dark') {
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "latest",
+ "react-dom": "latest",
"react-scripts": "latest",
"toastify-js": "1.12.0"
},
@@ -1666,7 +1660,7 @@ export default function App() {
```js src/useFadeIn.js active
import { useState, useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
export function useFadeIn(ref, duration) {
const [isRunning, setIsRunning] = useState(true);
@@ -1716,22 +1710,6 @@ html, body { min-height: 300px; }
}
```
-```json package.json hidden
-{
- "dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
- "react-scripts": "latest"
- },
- "scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test --env=jsdom",
- "eject": "react-scripts eject"
- }
-}
-```
-
However, you didn't *have to* do that. As with regular functions, ultimately you decide where to draw the boundaries between different parts of your code. You could also take a very different approach. Instead of keeping the logic in the Effect, you could move most of the imperative logic inside a JavaScript [class:](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes)
@@ -2205,22 +2183,6 @@ It looks like your `useInterval` Hook accepts an event listener as an argument.
-```json package.json hidden
-{
- "dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
- "react-scripts": "latest"
- },
- "scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test --env=jsdom",
- "eject": "react-scripts eject"
- }
-}
-```
-
```js
import { useCounter } from './useCounter.js';
import { useInterval } from './useInterval.js';
@@ -2252,7 +2214,7 @@ export function useCounter(delay) {
```js src/useInterval.js
import { useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
export function useInterval(onTick, delay) {
useEffect(() => {
@@ -2276,22 +2238,6 @@ With this change, both intervals work as expected and don't interfere with each
-```json package.json hidden
-{
- "dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
- "react-scripts": "latest"
- },
- "scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test --env=jsdom",
- "eject": "react-scripts eject"
- }
-}
-```
-
```js
import { useCounter } from './useCounter.js';
@@ -2324,7 +2270,7 @@ export function useCounter(delay) {
```js src/useInterval.js active
import { useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
export function useInterval(callback, delay) {
const onTick = useEffectEvent(callback);
diff --git a/src/content/learn/separating-events-from-effects.md b/src/content/learn/separating-events-from-effects.md
index fd603c395..13e0ad912 100644
--- a/src/content/learn/separating-events-from-effects.md
+++ b/src/content/learn/separating-events-from-effects.md
@@ -400,13 +400,7 @@ You need a way to separate this non-reactive logic from the reactive Effect arou
### Declaring an Effect Event {/*declaring-an-effect-event*/}
-
-
-This section describes an **experimental API that has not yet been released** in a stable version of React.
-
-
-
-Use a special Hook called [`useEffectEvent`](/reference/react/experimental_useEffectEvent) to extract this non-reactive logic out of your Effect:
+Use a special Hook called [`useEffectEvent`](/reference/react/useEffectEvent) to extract this non-reactive logic out of your Effect:
```js {1,4-6}
import { useEffect, useEffectEvent } from 'react';
@@ -448,8 +442,8 @@ Verify that the new behavior works as you would expect:
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "latest",
+ "react-dom": "latest",
"react-scripts": "latest",
"toastify-js": "1.12.0"
},
@@ -464,7 +458,7 @@ Verify that the new behavior works as you would expect:
```js
import { useState, useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
import { createConnection, sendMessage } from './chat.js';
import { showNotification } from './notifications.js';
@@ -578,12 +572,6 @@ You can think of Effect Events as being very similar to event handlers. The main
### Reading latest props and state with Effect Events {/*reading-latest-props-and-state-with-effect-events*/}
-
-
-This section describes an **experimental API that has not yet been released** in a stable version of React.
-
-
-
Effect Events let you fix many patterns where you might be tempted to suppress the dependency linter.
For example, say you have an Effect to log the page visits:
@@ -725,7 +713,7 @@ function Page({ url }) {
}
```
-After `useEffectEvent` becomes a stable part of React, we recommend **never suppressing the linter**.
+We recommend **never suppressing the linter**.
The first downside of suppressing the rule is that React will no longer warn you when your Effect needs to "react" to a new reactive dependency you've introduced to your code. In the earlier example, you added `url` to the dependencies *because* React reminded you to do it. You will no longer get such reminders for any future edits to that Effect if you disable the linter. This leads to bugs.
@@ -800,25 +788,9 @@ With `useEffectEvent`, there is no need to "lie" to the linter, and the code wor
-```json package.json hidden
-{
- "dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
- "react-scripts": "latest"
- },
- "scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test --env=jsdom",
- "eject": "react-scripts eject"
- }
-}
-```
-
```js
import { useState, useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
export default function App() {
const [position, setPosition] = useState({ x: 0, y: 0 });
@@ -878,12 +850,6 @@ Read [Removing Effect Dependencies](/learn/removing-effect-dependencies) for oth
### Limitations of Effect Events {/*limitations-of-effect-events*/}
-
-
-This section describes an **experimental API that has not yet been released** in a stable version of React.
-
-
-
Effect Events are very limited in how you can use them:
* **Only call them from inside Effects.**
@@ -973,6 +939,7 @@ To fix this code, it's enough to follow the rules.
+<<<<<<< HEAD
```json package.json hidden
{
"dependencies": {
@@ -990,6 +957,8 @@ To fix this code, it's enough to follow the rules.
```
+=======
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
```js {expectedErrors: {'react-compiler': [14]}}
import { useState, useEffect } from 'react';
@@ -1121,25 +1090,9 @@ It seems like the Effect which sets up the timer "reacts" to the `increment` val
-```json package.json hidden
-{
- "dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
- "react-scripts": "latest"
- },
- "scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test --env=jsdom",
- "eject": "react-scripts eject"
- }
-}
-```
-
```js
import { useState, useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
export default function Timer() {
const [count, setCount] = useState(0);
@@ -1190,25 +1143,9 @@ To solve the issue, extract an `onTick` Effect Event from the Effect:
-```json package.json hidden
-{
- "dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
- "react-scripts": "latest"
- },
- "scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test --env=jsdom",
- "eject": "react-scripts eject"
- }
-}
-```
-
```js
import { useState, useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
export default function Timer() {
const [count, setCount] = useState(0);
@@ -1272,25 +1209,9 @@ Code inside Effect Events is not reactive. Are there cases in which you would _w
-```json package.json hidden
-{
- "dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
- "react-scripts": "latest"
- },
- "scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test --env=jsdom",
- "eject": "react-scripts eject"
- }
-}
-```
-
```js
import { useState, useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
export default function Timer() {
const [count, setCount] = useState(0);
@@ -1359,25 +1280,9 @@ The problem with the above example is that it extracted an Effect Event called `
-```json package.json hidden
-{
- "dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
- "react-scripts": "latest"
- },
- "scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test --env=jsdom",
- "eject": "react-scripts eject"
- }
-}
-```
-
```js
import { useState, useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
export default function Timer() {
const [count, setCount] = useState(0);
@@ -1458,8 +1363,8 @@ Your Effect knows which room it connected to. Is there any information that you
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "latest",
+ "react-dom": "latest",
"react-scripts": "latest",
"toastify-js": "1.12.0"
},
@@ -1474,7 +1379,7 @@ Your Effect knows which room it connected to. Is there any information that you
```js
import { useState, useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
import { createConnection, sendMessage } from './chat.js';
import { showNotification } from './notifications.js';
@@ -1599,8 +1504,8 @@ To fix the issue, instead of reading the *latest* `roomId` inside the Effect Eve
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "latest",
+ "react-dom": "latest",
"react-scripts": "latest",
"toastify-js": "1.12.0"
},
@@ -1615,7 +1520,7 @@ To fix the issue, instead of reading the *latest* `roomId` inside the Effect Eve
```js
import { useState, useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
import { createConnection, sendMessage } from './chat.js';
import { showNotification } from './notifications.js';
@@ -1736,8 +1641,8 @@ To solve the additional challenge, save the notification timeout ID and clear it
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "latest",
+ "react-dom": "latest",
"react-scripts": "latest",
"toastify-js": "1.12.0"
},
@@ -1752,7 +1657,7 @@ To solve the additional challenge, save the notification timeout ID and clear it
```js
import { useState, useEffect } from 'react';
-import { experimental_useEffectEvent as useEffectEvent } from 'react';
+import { useEffectEvent } from 'react';
import { createConnection, sendMessage } from './chat.js';
import { showNotification } from './notifications.js';
diff --git a/src/content/reference/dev-tools/react-performance-tracks.md b/src/content/reference/dev-tools/react-performance-tracks.md
new file mode 100644
index 000000000..4f613f802
--- /dev/null
+++ b/src/content/reference/dev-tools/react-performance-tracks.md
@@ -0,0 +1,152 @@
+---
+title: React Performance tracks
+---
+
+
+
+React Performance tracks are specialized custom entries that appear on the Performance panel's timeline in your browser developer tools.
+
+
+
+These tracks are designed to provide developers with comprehensive insights into their React application's performance by visualizing React-specific events and metrics alongside other critical data sources such as network requests, JavaScript execution, and event loop activity, all synchronized on a unified timeline within the Performance panel for a complete understanding of application behavior.
+
+
+
+
+
+
+
+
+---
+
+## Usage {/*usage*/}
+
+React Performance tracks are only available in development and profiling builds of React:
+
+- **Development**: enabled by default.
+- **Profiling**: you can either wrap a subtree that you want to instrument with [``](/reference/react/Profiler) component or have [React Developer Tools extension](/learn/react-developer-tools) enabled. Tracks specific to React Server Components are not enabled in profiling builds.
+
+If enabled, tracks should appear automatically in the traces you record with the Performance panel of browsers that provide [extensibility APIs](https://developer.chrome.com/docs/devtools/performance/extension).
+
+
+
+The profiling instrumentation that powers React Performance tracks adds some additional overhead, so it is disabled in production builds by default.
+Server Components and Server Requests tracks are only available in development builds.
+
+
+
+---
+
+## Tracks {/*tracks*/}
+
+### Scheduler {/*scheduler*/}
+
+The Scheduler is an internal React concept used for managing tasks with different priorities. This track consists of 4 subtracks, each representing work of a specific priority:
+
+- **Blocking** - The synchronous updates, which could've been initiated by user interactions.
+- **Transition** - Non-blocking work that happens in the background, usually initiated via [`startTransition`](/reference/react/startTransition).
+- **Suspense** - Work related to Suspense boundaries, such as displaying fallbacks or revealing content.
+- **Idle** - The lowest priority work that is done when there are no other tasks with higher priority.
+
+
+
+
+
+
+#### Renders {/*renders*/}
+
+Every render pass consists of multiple phases that you can see on a timeline:
+
+- **Update** - this is what caused a new render pass.
+- **Render** - React renders the updated subtree by calling render functions of components. You can see the rendered components subtree on [Components track](#components), which follows the same color scheme.
+- **Commit** - After rendering components, React will submit the changes to the DOM and run layout effects, like [`useLayoutEffect`](/reference/react/useLayoutEffect).
+- **Remaining Effects** - React runs passive effects of a rendered subtree. This usually happens after the paint, and this is when React runs hooks like [`useEffect`](/reference/react/useEffect). One known exception is user interactions, like clicks, or other discrete events. In this scenario, this phase could run before the paint.
+
+
+
+
+
+
+[Learn more about renders and commits](/learn/render-and-commit).
+
+#### Cascading updates {/*cascading-updates*/}
+
+Cascading updates is one of the patterns for performance regressions. If an update was scheduled during a render pass, React could discard completed work and start a new pass.
+
+In development builds, React can show you which Component scheduled a new update. This includes both general updates and cascading ones. You can see the enhanced stack trace by clicking on the "Cascading update" entry, which should also display the name of the method that scheduled an update.
+
+
+
+
+
+
+[Learn more about Effects](/learn/you-might-not-need-an-effect).
+
+### Components {/*components*/}
+
+The Components track visualizes the durations of React components. They are displayed as a flamegraph, where each entry represents the duration of the corresponding component render and all its descendant children components.
+
+
+
+
+
+
+Similar to render durations, effect durations are also represented as a flamegraph, but with a different color scheme that aligns with the corresponding phase on the Scheduler track.
+
+
+
+
+
+
+
+
+Unlike renders, not all effects are shown on the Components track by default.
+
+To maintain performance and prevent UI clutter, React will only display those effects, which had a duration of 0.05ms or longer, or triggered an update.
+
+
+
+Additional events may be displayed during the render and effects phases:
+
+- Mount - A corresponding subtree of component renders or effects was mounted.
+- Unmount - A corresponding subtree of component renders or effects was unmounted.
+- Reconnect - Similar to Mount, but limited to cases when [``](/reference/react/Activity) is used.
+- Disconnect - Similar to Unmount, but limited to cases when [``](/reference/react/Activity) is used.
+
+#### Changed props {/*changed-props*/}
+
+In development builds, when you click on a component render entry, you can inspect potential changes in props. You can use this information to identify unnecessary renders.
+
+
+
+
+
+
+### Server {/*server*/}
+
+
+
+
+
+
+#### Server Requests {/*server-requests*/}
+
+The Server Requests track visualized all Promises that eventually end up in a React Server Component. This includes any `async` operations like calling `fetch` or async Node.js file operations.
+
+React will try to combine Promises that are started from inside third-party code into a single span representing the the duration of the entire operation blocking 1st party code.
+For example, a third party library method called `getUser` that calls `fetch` internally multiple times will be represented as a single span called `getUser`, instead of showing multiple `fetch` spans.
+
+Clicking on spans will show you a stack trace of where the Promise was created as well as a view of the value that the Promise resolved to, if available.
+
+Rejected Promises are displayed as red with their rejected value.
+
+#### Server Components {/*server-components*/}
+
+The Server Components tracks visualize the durations of React Server Components Promises they awaited. Timings are displayed as a flamegraph, where each entry represents the duration of the corresponding component render and all its descendant children components.
+
+If you await a Promise, React will display duration of that Promise. To see all I/O operations, use the Server Requests track.
+
+Different colors are used to indicate the duration of the component render. The darker the color, the longer the duration.
+
+The Server Components track group will always contain a "Primary" track. If React is able to render Server Components concurrently, it will display addititional "Parallel" tracks.
+If more than 8 Server Components are rendered concurrently, React will associate them with the last "Parallel" track instead of adding more tracks.
diff --git a/src/content/reference/eslint-plugin-react-hooks/index.md b/src/content/reference/eslint-plugin-react-hooks/index.md
index 6494bd78f..6cde06b98 100644
--- a/src/content/reference/eslint-plugin-react-hooks/index.md
+++ b/src/content/reference/eslint-plugin-react-hooks/index.md
@@ -1,5 +1,9 @@
---
title: eslint-plugin-react-hooks
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
@@ -16,12 +20,29 @@ When the compiler reports a diagnostic, it means that the compiler was able to s
What this means for linting, is that you don’t need to fix all violations immediately. Address them at your own pace to gradually increase the number of optimized components.
+<<<<<<< HEAD
## Available Lints {/*available-lints*/}
* [`component-hook-factories`](/reference/eslint-plugin-react-hooks/lints/component-hook-factories) - Validates against higher order functions defining nested components or hooks
* [`config`](/reference/eslint-plugin-react-hooks/lints/config) - Validates the compiler configuration options
* [`error-boundaries`](/reference/eslint-plugin-react-hooks/lints/error-boundaries) - Validates usage of Error Boundaries instead of try/catch for child errors
* [`exhaustive-deps`](/reference/eslint-plugin-react-hooks/lints/exhaustive-deps) - Validates that dependency arrays for React hooks contain all necessary dependencies
+=======
+## Recommended Rules {/*recommended*/}
+
+These rules are included in the `recommended` preset `eslint-plugin-react-hooks`:
+
+* [`exhaustive-deps`](/reference/eslint-plugin-react-hooks/lints/exhaustive-deps) - Validates that dependency arrays for React hooks contain all necessary dependencies
+* [`rules-of-hooks`](/reference/eslint-plugin-react-hooks/lints/rules-of-hooks) - Validates that components and hooks follow the Rules of Hooks
+
+## Additional Rules {/*additional-rules*/}
+
+Starting in version 6.0, these rules are available to opt-in:
+
+* [`component-hook-factories`](/reference/eslint-plugin-react-hooks/lints/component-hook-factories) - Validates higher order functions defining nested components or hooks
+* [`config`](/reference/eslint-plugin-react-hooks/lints/config) - Validates the compiler configuration options
+* [`error-boundaries`](/reference/eslint-plugin-react-hooks/lints/error-boundaries) - Validates usage of Error Boundaries instead of try/catch for child errors
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
* [`gating`](/reference/eslint-plugin-react-hooks/lints/gating) - Validates configuration of gating mode
* [`globals`](/reference/eslint-plugin-react-hooks/lints/globals) - Validates against assignment/mutation of globals during render
* [`immutability`](/reference/eslint-plugin-react-hooks/lints/immutability) - Validates against mutating props, state, and other immutable values
@@ -29,7 +50,10 @@ What this means for linting, is that you don’t need to fix all violations imme
* [`preserve-manual-memoization`](/reference/eslint-plugin-react-hooks/lints/preserve-manual-memoization) - Validates that existing manual memoization is preserved by the compiler
* [`purity`](/reference/eslint-plugin-react-hooks/lints/purity) - Validates that components/hooks are pure by checking known-impure functions
* [`refs`](/reference/eslint-plugin-react-hooks/lints/refs) - Validates correct usage of refs, not reading/writing during render
+<<<<<<< HEAD
* [`rules-of-hooks`](/reference/eslint-plugin-react-hooks/lints/rules-of-hooks) - Validates that components and hooks follow the Rules of Hooks
+=======
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
* [`set-state-in-effect`](/reference/eslint-plugin-react-hooks/lints/set-state-in-effect) - Validates against calling setState synchronously in an effect
* [`set-state-in-render`](/reference/eslint-plugin-react-hooks/lints/set-state-in-render) - Validates against setting state during render
* [`static-components`](/reference/eslint-plugin-react-hooks/lints/static-components) - Validates that components are static, not recreated every render
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/component-hook-factories.md b/src/content/reference/eslint-plugin-react-hooks/lints/component-hook-factories.md
index 537903abd..b9adb3c36 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/component-hook-factories.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/component-hook-factories.md
@@ -8,6 +8,15 @@ Validates against higher order functions defining nested components or hooks. Co
+<<<<<<< HEAD
+=======
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Rule Details {/*rule-details*/}
Defining components or hooks inside other functions creates new instances on every call. React treats each as a completely different component, destroying and recreating the entire component tree, losing all state, and causing performance problems.
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/config.md b/src/content/reference/eslint-plugin-react-hooks/lints/config.md
index 719e08412..0778a5942 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/config.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/config.md
@@ -1,5 +1,9 @@
---
title: config
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
@@ -8,6 +12,15 @@ Validates the compiler [configuration options](/reference/react-compiler/configu
+<<<<<<< HEAD
+=======
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Rule Details {/*rule-details*/}
React Compiler accepts various [configuration options](/reference/react-compiler/configuration) to control its behavior. This rule validates that your configuration uses correct option names and value types, preventing silent failures from typos or incorrect settings.
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/error-boundaries.md b/src/content/reference/eslint-plugin-react-hooks/lints/error-boundaries.md
index 830098e5b..eeb334f0e 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/error-boundaries.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/error-boundaries.md
@@ -1,5 +1,9 @@
---
title: error-boundaries
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
@@ -8,6 +12,15 @@ Validates usage of Error Boundaries instead of try/catch for errors in child com
+<<<<<<< HEAD
+=======
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Rule Details {/*rule-details*/}
Try/catch blocks can't catch errors that happen during React's rendering process. Errors thrown in rendering methods or hooks bubble up through the component tree. Only [Error Boundaries](/reference/react/Component#catching-rendering-errors-with-an-error-boundary) can catch these errors.
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/exhaustive-deps.md b/src/content/reference/eslint-plugin-react-hooks/lints/exhaustive-deps.md
index cd26483a1..8c85bfb59 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/exhaustive-deps.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/exhaustive-deps.md
@@ -140,7 +140,25 @@ useEffect(() => {
## Options {/*options*/}
+<<<<<<< HEAD
This rule accepts an options object:
+=======
+You can configure custom effect hooks using shared ESLint settings (available in `eslint-plugin-react-hooks` 6.1.1 and later):
+
+```js
+{
+ "settings": {
+ "react-hooks": {
+ "additionalEffectHooks": "(useMyEffect|useCustomEffect)"
+ }
+ }
+}
+```
+
+- `additionalEffectHooks`: Regex pattern matching custom hooks that should be checked for exhaustive dependencies. This configuration is shared across all `react-hooks` rules.
+
+For backward compatibility, this rule also accepts a rule-level option:
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
```js
{
@@ -152,4 +170,8 @@ This rule accepts an options object:
}
```
+<<<<<<< HEAD
- `additionalHooks`: Regex for hooks that should be checked for exhaustive dependencies
+=======
+- `additionalHooks`: Regex for hooks that should be checked for exhaustive dependencies. **Note:** If this rule-level option is specified, it takes precedence over the shared `settings` configuration.
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/gating.md b/src/content/reference/eslint-plugin-react-hooks/lints/gating.md
index 3bd662a86..9fbdb7382 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/gating.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/gating.md
@@ -1,5 +1,9 @@
---
title: gating
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
@@ -8,6 +12,15 @@ Validates configuration of [gating mode](/reference/react-compiler/gating).
+<<<<<<< HEAD
+=======
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Rule Details {/*rule-details*/}
Gating mode lets you gradually adopt React Compiler by marking specific components for optimization. This rule ensures your gating configuration is valid so the compiler knows which components to process.
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/globals.md b/src/content/reference/eslint-plugin-react-hooks/lints/globals.md
index fe0cbe008..e27fb56ae 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/globals.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/globals.md
@@ -1,5 +1,9 @@
---
title: globals
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
@@ -8,6 +12,15 @@ Validates against assignment/mutation of globals during render, part of ensuring
+<<<<<<< HEAD
+=======
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Rule Details {/*rule-details*/}
Global variables exist outside React's control. When you modify them during render, you break React's assumption that rendering is pure. This can cause components to behave differently in development vs production, break Fast Refresh, and make your app impossible to optimize with features like React Compiler.
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/immutability.md b/src/content/reference/eslint-plugin-react-hooks/lints/immutability.md
index 2314cde06..ba56191d9 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/immutability.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/immutability.md
@@ -1,5 +1,9 @@
---
title: immutability
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
@@ -8,6 +12,15 @@ Validates against mutating props, state, and other values that [are immutable](/
+<<<<<<< HEAD
+=======
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Rule Details {/*rule-details*/}
A component’s props and state are immutable snapshots. Never mutate them directly. Instead, pass new props down, and use the setter function from `useState`.
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/incompatible-library.md b/src/content/reference/eslint-plugin-react-hooks/lints/incompatible-library.md
index e057e1978..aea441aa9 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/incompatible-library.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/incompatible-library.md
@@ -1,5 +1,9 @@
---
title: incompatible-library
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
@@ -10,6 +14,15 @@ Validates against usage of libraries which are incompatible with memoization (ma
+<<<<<<< HEAD
+=======
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
These libraries were designed before React's memoization rules were fully documented. They made the correct choices at the time to optimize for ergonomic ways to keep components just the right amount of reactive as app state changes. While these legacy patterns worked, we have since discovered that it's incompatible with React's programming model. We will continue working with library authors to migrate these libraries to use patterns that follow the Rules of React.
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/preserve-manual-memoization.md b/src/content/reference/eslint-plugin-react-hooks/lints/preserve-manual-memoization.md
index 93b582b1e..22cfa2cfe 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/preserve-manual-memoization.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/preserve-manual-memoization.md
@@ -1,5 +1,9 @@
---
title: preserve-manual-memoization
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
@@ -8,6 +12,15 @@ Validates that existing manual memoization is preserved by the compiler. React C
+<<<<<<< HEAD
+=======
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Rule Details {/*rule-details*/}
React Compiler preserves your existing `useMemo`, `useCallback`, and `React.memo` calls. If you've manually memoized something, the compiler assumes you had a good reason and won't remove it. However, incomplete dependencies prevent the compiler from understanding your code's data flow and applying further optimizations.
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/purity.md b/src/content/reference/eslint-plugin-react-hooks/lints/purity.md
index af8aacc61..ad34e5d7d 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/purity.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/purity.md
@@ -1,5 +1,9 @@
---
title: purity
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
@@ -8,6 +12,15 @@ Validates that [components/hooks are pure](/reference/rules/components-and-hooks
+<<<<<<< HEAD
+=======
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Rule Details {/*rule-details*/}
React components must be pure functions - given the same props, they should always return the same JSX. When components use functions like `Math.random()` or `Date.now()` during render, they produce different output each time, breaking React's assumptions and causing bugs like hydration mismatches, incorrect memoization, and unpredictable behavior.
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/refs.md b/src/content/reference/eslint-plugin-react-hooks/lints/refs.md
index 3108fdd89..c25b37826 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/refs.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/refs.md
@@ -1,5 +1,9 @@
---
title: refs
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
@@ -8,6 +12,15 @@ Validates correct usage of refs, not reading/writing during render. See the "pit
+<<<<<<< HEAD
+=======
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Rule Details {/*rule-details*/}
Refs hold values that aren't used for rendering. Unlike state, changing a ref doesn't trigger a re-render. Reading or writing `ref.current` during render breaks React's expectations. Refs might not be initialized when you try to read them, and their values can be stale or inconsistent.
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/rules-of-hooks.md b/src/content/reference/eslint-plugin-react-hooks/lints/rules-of-hooks.md
index 6508fc867..8e14c85be 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/rules-of-hooks.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/rules-of-hooks.md
@@ -159,3 +159,24 @@ const [permissions, setPermissions] = useState(
userType === 'admin' ? adminPerms : userPerms
);
```
+<<<<<<< HEAD
+=======
+
+## Options {/*options*/}
+
+You can configure custom effect hooks using shared ESLint settings (available in `eslint-plugin-react-hooks` 6.1.1 and later):
+
+```js
+{
+ "settings": {
+ "react-hooks": {
+ "additionalEffectHooks": "(useMyEffect|useCustomEffect)"
+ }
+ }
+}
+```
+
+- `additionalEffectHooks`: Regex pattern matching custom hooks that should be treated as effects. This allows `useEffectEvent` and similar event functions to be called from your custom effect hooks.
+
+This shared configuration is used by both `rules-of-hooks` and `exhaustive-deps` rules, ensuring consistent behavior across all hook-related linting.
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/set-state-in-effect.md b/src/content/reference/eslint-plugin-react-hooks/lints/set-state-in-effect.md
index 8c6a7cb47..886a70afc 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/set-state-in-effect.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/set-state-in-effect.md
@@ -1,5 +1,9 @@
---
title: set-state-in-effect
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
@@ -8,6 +12,15 @@ Validates against calling setState synchronously in an effect, which can lead to
+<<<<<<< HEAD
+=======
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Rule Details {/*rule-details*/}
Setting state immediately inside an effect forces React to restart the entire render cycle. When you update state in an effect, React must re-render your component, apply changes to the DOM, and then run effects again. This creates an extra render pass that could have been avoided by transforming data directly during render or deriving state from props. Transform data at the top level of your component instead. This code will naturally re-run when props or state change without triggering additional render cycles.
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/set-state-in-render.md b/src/content/reference/eslint-plugin-react-hooks/lints/set-state-in-render.md
index 61852990a..983c68ddb 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/set-state-in-render.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/set-state-in-render.md
@@ -1,9 +1,14 @@
---
title: set-state-in-render
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
+<<<<<<< HEAD
Validates against setting state during render, which can trigger additional renders and potential infinite render loops.
@@ -11,13 +16,32 @@ Validates against setting state during render, which can trigger additional rend
## Rule Details {/*rule-details*/}
Calling `setState` during render triggers another render before the current one finishes. This creates an infinite loop that crashes your app.
+=======
+Validates against unconditionally setting state during render, which can trigger additional renders and potential infinite render loops.
+
+
+
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+## Rule Details {/*rule-details*/}
+
+Calling `setState` during render unconditionally triggers another render before the current one finishes. This creates an infinite loop that crashes your app.
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Common Violations {/*common-violations*/}
### Invalid {/*invalid*/}
```js {expectedErrors: {'react-compiler': [4]}}
+<<<<<<< HEAD
// ❌ setState directly in render
+=======
+// ❌ Unconditional setState directly in render
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
function Component({value}) {
const [count, setCount] = useState(0);
setCount(value); // Infinite loop!
@@ -50,6 +74,22 @@ function Component({user}) {
const email = user?.email || '';
return
{name}
;
}
+<<<<<<< HEAD
+=======
+
+// ✅ Conditionally derive state from props and state from previous renders
+function Component({ items }) {
+ const [isReverse, setIsReverse] = useState(false);
+ const [selection, setSelection] = useState(null);
+
+ const [prevItems, setPrevItems] = useState(items);
+ if (items !== prevItems) { // This condition makes it valid
+ setPrevItems(items);
+ setSelection(null);
+ }
+ // ...
+}
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
```
## Troubleshooting {/*troubleshooting*/}
@@ -93,3 +133,8 @@ function Counter({max}) {
```
Now the setter only runs in response to the click, React finishes the render normally, and `count` never crosses `max`.
+<<<<<<< HEAD
+=======
+
+In rare cases, you may need to adjust state based on information from previous renders. For those, follow [this pattern](https://react.dev/reference/react/useState#storing-information-from-previous-renders) of setting state conditionally.
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/static-components.md b/src/content/reference/eslint-plugin-react-hooks/lints/static-components.md
index 709303612..63ca3dbd1 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/static-components.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/static-components.md
@@ -1,5 +1,9 @@
---
title: static-components
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
@@ -8,6 +12,15 @@ Validates that components are static, not recreated every render. Components tha
+<<<<<<< HEAD
+=======
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Rule Details {/*rule-details*/}
Components defined inside other components are recreated on every render. React sees each as a brand new component type, unmounting the old one and mounting the new one, destroying all state and DOM nodes in the process.
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/unsupported-syntax.md b/src/content/reference/eslint-plugin-react-hooks/lints/unsupported-syntax.md
index a3eefcdb2..0745d3ad2 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/unsupported-syntax.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/unsupported-syntax.md
@@ -1,5 +1,9 @@
---
title: unsupported-syntax
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
@@ -8,6 +12,15 @@ Validates against syntax that React Compiler does not support. If you need to, y
+<<<<<<< HEAD
+=======
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Rule Details {/*rule-details*/}
React Compiler needs to statically analyze your code to apply optimizations. Features like `eval` and `with` make it impossible to statically understand what the code does at compile time, so the compiler can't optimize components that use them.
diff --git a/src/content/reference/eslint-plugin-react-hooks/lints/use-memo.md b/src/content/reference/eslint-plugin-react-hooks/lints/use-memo.md
index 54bbe1579..3253a0ef3 100644
--- a/src/content/reference/eslint-plugin-react-hooks/lints/use-memo.md
+++ b/src/content/reference/eslint-plugin-react-hooks/lints/use-memo.md
@@ -1,13 +1,30 @@
---
title: use-memo
+<<<<<<< HEAD
+=======
+version: rc
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
---
+<<<<<<< HEAD
Validates usage of the `useMemo` hook without a return value. See [`useMemo` docs](/reference/react/useMemo) for more information.
+=======
+Validates that the `useMemo` hook is used with a return value. See [`useMemo` docs](/reference/react/useMemo) for more information.
+
+
+
+
+
+This rule is available in `eslint-plugin-react-hooks` v6.
+
+
+
+>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
## Rule Details {/*rule-details*/}
`useMemo` is for computing and caching expensive values, not for side effects. Without a return value, `useMemo` returns `undefined`, which defeats its purpose and likely indicates you're using the wrong hook.
diff --git a/src/content/reference/react-dom/server/index.md b/src/content/reference/react-dom/server/index.md
index 72972c327..943b610f2 100644
--- a/src/content/reference/react-dom/server/index.md
+++ b/src/content/reference/react-dom/server/index.md
@@ -10,19 +10,27 @@ The `react-dom/server` APIs let you server-side render React components to HTML.
---
-## Server APIs for Node.js Streams {/*server-apis-for-nodejs-streams*/}
+## Server APIs for Web Streams {/*server-apis-for-web-streams*/}
-These methods are only available in the environments with [Node.js Streams:](https://nodejs.org/api/stream.html)
+These methods are only available in the environments with [Web Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API), which includes browsers, Deno, and some modern edge runtimes:
-* [`renderToPipeableStream`](/reference/react-dom/server/renderToPipeableStream) renders a React tree to a pipeable [Node.js Stream.](https://nodejs.org/api/stream.html)
+* [`renderToReadableStream`](/reference/react-dom/server/renderToReadableStream) renders a React tree to a [Readable Web Stream.](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)
+* [`resume`](/reference/react-dom/server/renderToPipeableStream) resumes [`prerender`](/reference/react-dom/static/prerender) to a [Readable Web Stream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).
+
+
+
+Node.js also includes these methods for compatibility, but they are not recommended due to worse performance. Use the [dedicated Node.js APIs](#server-apis-for-nodejs-streams) instead.
+
+
---
-## Server APIs for Web Streams {/*server-apis-for-web-streams*/}
+## Server APIs for Node.js Streams {/*server-apis-for-nodejs-streams*/}
-These methods are only available in the environments with [Web Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API), which includes browsers, Deno, and some modern edge runtimes:
+These methods are only available in the environments with [Node.js Streams:](https://nodejs.org/api/stream.html)
-* [`renderToReadableStream`](/reference/react-dom/server/renderToReadableStream) renders a React tree to a [Readable Web Stream.](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)
+* [`renderToPipeableStream`](/reference/react-dom/server/renderToPipeableStream) renders a React tree to a pipeable [Node.js Stream.](https://nodejs.org/api/stream.html)
+* [`resumeToPipeableStream`](/reference/react-dom/server/renderToPipeableStream) resumes [`prerenderToNodeStream`](/reference/react-dom/static/prerenderToNodeStream) to a pipeable [Node.js Stream.](https://nodejs.org/api/stream.html)
---
diff --git a/src/content/reference/react-dom/server/resume.md b/src/content/reference/react-dom/server/resume.md
new file mode 100644
index 000000000..17b48b2ac
--- /dev/null
+++ b/src/content/reference/react-dom/server/resume.md
@@ -0,0 +1,236 @@
+---
+title: resume
+---
+
+
+
+`resume` streams a pre-rendered React tree to a [Readable Web Stream.](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)
+
+```js
+const stream = await resume(reactNode, postponedState, options?)
+```
+
+
+
+
+
+
+
+This API depends on [Web Streams.](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) For Node.js, use [`resumeToNodeStream`](/reference/react-dom/server/renderToPipeableStream) instead.
+
+
+
+---
+
+## Reference {/*reference*/}
+
+### `resume(node, postponedState, options?)` {/*resume*/}
+
+Call `resume` to resume rendering a pre-rendered React tree as HTML into a [Readable Web Stream.](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)
+
+```js
+import { resume } from 'react-dom/server';
+import {getPostponedState} from './storage';
+
+async function handler(request, writable) {
+ const postponed = await getPostponedState(request);
+ const resumeStream = await resume(, postponed);
+ return resumeStream.pipeTo(writable)
+}
+```
+
+[See more examples below.](#usage)
+
+#### Parameters {/*parameters*/}
+
+* `reactNode`: The React node you called `prerender` with. For example, a JSX element like ``. It is expected to represent the entire document, so the `App` component should render the `` tag.
+* `postponedState`: The opaque `postpone` object returned from a [prerender API](/reference/react-dom/static/index), loaded from wherever you stored it (e.g. redis, a file, or S3).
+* **optional** `options`: An object with streaming options.
+ * **optional** `nonce`: A [`nonce`](http://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#nonce) string to allow scripts for [`script-src` Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src).
+ * **optional** `signal`: An [abort signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that lets you [abort server rendering](#aborting-server-rendering) and render the rest on the client.
+ * **optional** `onError`: A callback that fires whenever there is a server error, whether [recoverable](/reference/react-dom/server/renderToReadableStream#recovering-from-errors-outside-the-shell) or [not.](/reference/react-dom/server/renderToReadableStream#recovering-from-errors-inside-the-shell) By default, this only calls `console.error`. If you override it to [log crash reports,](/reference/react-dom/server/renderToReadableStream#logging-crashes-on-the-server) make sure that you still call `console.error`.
+
+
+#### Returns {/*returns*/}
+
+`resume` returns a Promise:
+
+- If `resume` successfully produced a [shell](/reference/react-dom/server/renderToReadableStream#specifying-what-goes-into-the-shell), that Promise will resolve to a [Readable Web Stream.](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) that can be piped to a [Writable Web Stream.](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream).
+- If an error happens in the shell, the Promise will reject with that error.
+
+The returned stream has an additional property:
+
+* `allReady`: A Promise that resolves when all rendering is complete. You can `await stream.allReady` before returning a response [for crawlers and static generation.](/reference/react-dom/server/renderToReadableStream#waiting-for-all-content-to-load-for-crawlers-and-static-generation) If you do that, you won't get any progressive loading. The stream will contain the final HTML.
+
+#### Caveats {/*caveats*/}
+
+- `resume` does not accept options for `bootstrapScripts`, `bootstrapScriptContent`, or `bootstrapModules`. Instead, you need to pass these options to the `prerender` call that generates the `postponedState`. You can also inject bootstrap content into the writable stream manually.
+- `resume` does not accept `identifierPrefix` since the prefix needs to be the same in both `prerender` and `resume`.
+- Since `nonce` cannot be provided to prerender, you should only provide `nonce` to `resume` if you're not providing scripts to prerender.
+- `resume` re-renders from the root until it finds a component that was not fully pre-rendered. Only fully prerendered Components (the Component and its children finished prerendering) are skipped entirely.
+
+## Usage {/*usage*/}
+
+### Resuming a prerender {/*resuming-a-prerender*/}
+
+
+
+```js src/App.js hidden
+```
+
+```html public/index.html
+
+
+
+
+
+ Document
+
+
+
+
+
+```
+
+```js src/index.js
+import {
+ flushReadableStreamToFrame,
+ getUser,
+ Postponed,
+ sleep,
+} from "./demo-helpers";
+import { StrictMode, Suspense, use, useEffect } from "react";
+import { prerender } from "react-dom/static";
+import { resume } from "react-dom/server";
+import { hydrateRoot } from "react-dom/client";
+
+function Header() {
+ return Me and my descendants can be prerendered;
+}
+
+const { promise: cookies, resolve: resolveCookies } = Promise.withResolvers();
+
+function Main() {
+ const { sessionID } = use(cookies);
+ const user = getUser(sessionID);
+
+ useEffect(() => {
+ console.log("reached interactivity!");
+ }, []);
+
+ return (
+
+ Hello, {user.name}!
+
+
+ );
+}
+
+function Shell({ children }) {
+ // In a real app, this is where you would put your html and body.
+ // We're just using tags here we can include in an existing body for demonstration purposes
+ return (
+
+ {children}
+
+ );
+}
+
+function App() {
+ return (
+
+
+
+
+
+
+
+
+ );
+}
+
+async function main(frame) {
+ // Layer 1
+ const controller = new AbortController();
+ const prerenderedApp = prerender(, {
+ signal: controller.signal,
+ onError(error) {
+ if (error instanceof Postponed) {
+ } else {
+ console.error(error);
+ }
+ },
+ });
+ // We're immediately aborting in a macrotask.
+ // Any data fetching that's not available synchronously, or in a microtask, will not have finished.
+ setTimeout(() => {
+ controller.abort(new Postponed());
+ });
+
+ const { prelude, postponed } = await prerenderedApp;
+ await flushReadableStreamToFrame(prelude, frame);
+
+ // Layer 2
+ // Just waiting here for demonstration purposes.
+ // In a real app, the prelude and postponed state would've been serialized in Layer 1 and Layer would deserialize them.
+ // The prelude content could be flushed immediated as plain HTML while
+ // React is continuing to render from where the prerender left off.
+ await sleep(2000);
+
+ // You would get the cookies from the incoming HTTP request
+ resolveCookies({ sessionID: "abc" });
+
+ const stream = await resume(, postponed);
+
+ await flushReadableStreamToFrame(stream, frame);
+
+ // Layer 3
+ // Just waiting here for demonstration purposes.
+ await sleep(2000);
+
+ hydrateRoot(frame.contentWindow.document, );
+}
+
+main(document.getElementById("container"));
+
+```
+
+```js src/demo-helpers.js
+export async function flushReadableStreamToFrame(readable, frame) {
+ const document = frame.contentWindow.document;
+ const decoder = new TextDecoder();
+ for await (const chunk of readable) {
+ const partialHTML = decoder.decode(chunk);
+ document.write(partialHTML);
+ }
+}
+
+// This doesn't need to be an error.
+// You can use any other means to check if an error during prerender was
+// from an intentional abort or a real error.
+export class Postponed extends Error {}
+
+// We're just hardcoding a session here.
+export function getUser(sessionID) {
+ return {
+ name: "Alice",
+ };
+}
+
+export function sleep(timeoutMS) {
+ return new Promise((resolve) => {
+ setTimeout(() => {
+ resolve();
+ }, timeoutMS);
+ });
+}
+```
+
+
+
+### Further reading {/*further-reading*/}
+
+Resuming behaves like `renderToReadableStream`. For more examples, check out the [usage section of `renderToReadableStream`](/reference/react-dom/server/renderToReadableStream#usage).
+The [usage section of `prerender`](/reference/react-dom/static/prerender#usage) includes examples of how to use `prerender` specifically.
\ No newline at end of file
diff --git a/src/content/reference/react-dom/server/resumeToPipeableStream.md b/src/content/reference/react-dom/server/resumeToPipeableStream.md
new file mode 100644
index 000000000..48caa3be6
--- /dev/null
+++ b/src/content/reference/react-dom/server/resumeToPipeableStream.md
@@ -0,0 +1,78 @@
+---
+title: resumeToPipeableStream
+---
+
+
+
+`resumeToPipeableStream` streams a pre-rendered React tree to a pipeable [Node.js Stream.](https://nodejs.org/api/stream.html)
+
+```js
+const {pipe, abort} = await resumeToPipeableStream(reactNode, postponedState, options?)
+```
+
+
+
+
+
+
+
+This API is specific to Node.js. Environments with [Web Streams,](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) like Deno and modern edge runtimes, should use [`resume`](/reference/react-dom/server/renderToReadableStream) instead.
+
+
+
+---
+
+## Reference {/*reference*/}
+
+### `resumeToPipeableStream(node, postponed, options?)` {/*resume-to-pipeable-stream*/}
+
+Call `resume` to resume rendering a pre-rendered React tree as HTML into a [Node.js Stream.](https://nodejs.org/api/stream.html#writable-streams)
+
+```js
+import { resume } from 'react-dom/server';
+import {getPostponedState} from './storage';
+
+async function handler(request, response) {
+ const postponed = await getPostponedState(request);
+ const {pipe} = resumeToPipeableStream(, postponed, {
+ onShellReady: () => {
+ pipe(response);
+ }
+ });
+}
+```
+
+[See more examples below.](#usage)
+
+#### Parameters {/*parameters*/}
+
+* `reactNode`: The React node you called `prerender` with. For example, a JSX element like ``. It is expected to represent the entire document, so the `App` component should render the `` tag.
+* `postponedState`: The opaque `postpone` object returned from a [prerender API](/reference/react-dom/static/index), loaded from wherever you stored it (e.g. redis, a file, or S3).
+* **optional** `options`: An object with streaming options.
+ * **optional** `nonce`: A [`nonce`](http://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#nonce) string to allow scripts for [`script-src` Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src).
+ * **optional** `signal`: An [abort signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that lets you [abort server rendering](#aborting-server-rendering) and render the rest on the client.
+ * **optional** `onError`: A callback that fires whenever there is a server error, whether [recoverable](/reference/react-dom/server/renderToReadableStream#recovering-from-errors-outside-the-shell) or [not.](/reference/react-dom/server/renderToReadableStream#recovering-from-errors-inside-the-shell) By default, this only calls `console.error`. If you override it to [log crash reports,](/reference/react-dom/server/renderToReadableStream#logging-crashes-on-the-server) make sure that you still call `console.error`.
+ * **optional** `onShellReady`: A callback that fires right after the [shell](#specifying-what-goes-into-the-shell) has finished. You can call `pipe` here to start streaming. React will [stream the additional content](#streaming-more-content-as-it-loads) after the shell along with the inline `