diff --git a/package.json b/package.json
index 0efe373e2..da064b703 100644
--- a/package.json
+++ b/package.json
@@ -63,7 +63,11 @@
"asyncro": "^3.0.0",
"autoprefixer": "^10.4.2",
"babel-eslint": "10.x",
+<<<<<<< HEAD
"babel-plugin-react-compiler": "^19.1.0-rc.3",
+=======
+ "babel-plugin-react-compiler": "^1.0.0",
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
"chalk": "4.1.2",
"eslint": "7.x",
"eslint-config-next": "12.0.3",
diff --git a/public/images/blog/react-foundation/react_foundation_logo.png b/public/images/blog/react-foundation/react_foundation_logo.png
new file mode 100644
index 000000000..51c19598f
Binary files /dev/null and b/public/images/blog/react-foundation/react_foundation_logo.png differ
diff --git a/public/images/blog/react-foundation/react_foundation_logo.webp b/public/images/blog/react-foundation/react_foundation_logo.webp
new file mode 100644
index 000000000..89efa6027
Binary files /dev/null and b/public/images/blog/react-foundation/react_foundation_logo.webp differ
diff --git a/public/images/blog/react-foundation/react_foundation_logo_dark.png b/public/images/blog/react-foundation/react_foundation_logo_dark.png
new file mode 100644
index 000000000..4aedaf464
Binary files /dev/null and b/public/images/blog/react-foundation/react_foundation_logo_dark.png differ
diff --git a/public/images/blog/react-foundation/react_foundation_logo_dark.webp b/public/images/blog/react-foundation/react_foundation_logo_dark.webp
new file mode 100644
index 000000000..09b48b70d
Binary files /dev/null and b/public/images/blog/react-foundation/react_foundation_logo_dark.webp differ
diff --git a/public/images/blog/react-foundation/react_foundation_member_logos.png b/public/images/blog/react-foundation/react_foundation_member_logos.png
new file mode 100644
index 000000000..e83659693
Binary files /dev/null and b/public/images/blog/react-foundation/react_foundation_member_logos.png differ
diff --git a/public/images/blog/react-foundation/react_foundation_member_logos.webp b/public/images/blog/react-foundation/react_foundation_member_logos.webp
new file mode 100644
index 000000000..babb3d57c
Binary files /dev/null and b/public/images/blog/react-foundation/react_foundation_member_logos.webp differ
diff --git a/public/images/blog/react-foundation/react_foundation_member_logos_dark.png b/public/images/blog/react-foundation/react_foundation_member_logos_dark.png
new file mode 100644
index 000000000..116e40337
Binary files /dev/null and b/public/images/blog/react-foundation/react_foundation_member_logos_dark.png differ
diff --git a/public/images/blog/react-foundation/react_foundation_member_logos_dark.webp b/public/images/blog/react-foundation/react_foundation_member_logos_dark.webp
new file mode 100644
index 000000000..5fcf38ca9
Binary files /dev/null and b/public/images/blog/react-foundation/react_foundation_member_logos_dark.webp differ
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' && (
-### React Compiler is now in RC! {/*react-compiler-is-now-in-rc*/}
+### React Compiler is now stable! {/*react-compiler-is-now-in-rc*/}
-Please see the [RC blog post](/blog/2025/04/21/react-compiler-rc) for details.
+Please see the [stable release blog post](/blog/2025/10/07/react-compiler-1) for details.
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..cdc8f353f 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).
@@ -68,7 +66,7 @@ To opt-in to animating an element, wrap it in the new `` compone
```
-This new component lets you declaratively define "what" to animate when an animation is activated.
+This new component lets you declaratively define "what" to animate when an animation is activated.
You can define "when" to animate by using one of these three triggers for a View Transition:
@@ -101,9 +99,9 @@ By default, these animations use the [default CSS animations for View Transition
When the DOM updates due to an animation trigger—like `startTransition`, `useDeferredValue`, or a `Suspense` fallback switching to content—React will use [declarative heuristics](/reference/react/ViewTransition#viewtransition) to automatically determine which `` components to activate for the animation. The browser will then run the animation that's defined in CSS.
-If you're familiar with the browser's View Transition API and want to know how React supports it, check out [How does `` Work](/reference/react/ViewTransition#how-does-viewtransition-work) in the docs.
+If you're familiar with the browser's View Transition API and want to know how React supports it, check out [How does `` Work](/reference/react/ViewTransition#how-does-viewtransition-work) in the docs.
-In this post, let's take a look at a few examples of how to use View Transitions.
+In this post, let's take a look at a few examples of how to use View Transitions.
We'll start with this app, which doesn't animate any of the following interactions:
- Click a video to view the details.
@@ -1247,8 +1245,8 @@ root.render(
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "canary",
+ "react-dom": "canary",
"react-scripts": "latest"
},
"scripts": {
@@ -1296,16 +1294,17 @@ function navigate(url) {
When the `url` changes, the `` and new route are rendered. Since the `` was updated inside of `startTransition`, the `` is activated for an animation.
-By default, View Transitions include the browser default cross-fade animation. Adding this to our example, we now have a cross-fade whenever we navigate between pages:
+By default, View Transitions include the browser default cross-fade animation. Adding this to our example, we now have a cross-fade whenever we navigate between pages:
```js src/App.js active
-import {unstable_ViewTransition as ViewTransition} from 'react'; import Details from './Details'; import Home from './Home'; import {useRouter} from './router';
+import {ViewTransition} from 'react'; import Details from './Details';
+import Home from './Home'; import {useRouter} from './router';
export default function App() {
const {url} = useRouter();
-
+
// Use ViewTransition to animate between pages.
// No additional CSS needed by default.
return (
@@ -1564,11 +1563,11 @@ export function IconSearch(props) {
```
```js src/Layout.js
-import {unstable_ViewTransition as ViewTransition} from 'react'; import { useIsNavPending } from "./router";
+import {ViewTransition} from 'react'; import { useIsNavPending } from "./router";
export default function Page({ heading, children }) {
const isPending = useIsNavPending();
-
+
return (
@@ -1772,22 +1771,22 @@ import {useState, createContext,use,useTransition,useLayoutEffect,useEffect} fro
export function Router({ children }) {
const [isPending, startTransition] = useTransition();
-
+
function navigate(url) {
// Update router state in transition.
startTransition(() => {
go(url);
});
}
-
-
-
-
+
+
+
+
const [routerState, setRouterState] = useState({
pendingNav: () => {},
url: document.location.pathname,
});
-
+
function go(url) {
setRouterState({
@@ -1797,7 +1796,7 @@ export function Router({ children }) {
},
});
}
-
+
function navigateBack(url) {
startTransition(() => {
@@ -2443,8 +2442,8 @@ root.render(
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "canary",
+ "react-dom": "canary",
"react-scripts": "latest"
},
"scripts": {
@@ -2458,7 +2457,7 @@ root.render(
-Since our router already updates the route using `startTransition`, this one line change to add `` activates with the default cross-fade animation.
+Since our router already updates the route using `startTransition`, this one line change to add `` activates with the default cross-fade animation.
If you're curious how this works, see the docs for [How does `` work?](/reference/react/ViewTransition#how-does-viewtransition-work)
@@ -2466,7 +2465,7 @@ If you're curious how this works, see the docs for [How does ``
#### Opting out of `` animations {/*opting-out-of-viewtransition-animations*/}
-In this example, we're wrapping the root of the app in `` for simplicity, but this means that all transitions in the app will be animated, which can lead to unexpected animations.
+In this example, we're wrapping the root of the app in `` for simplicity, but this means that all transitions in the app will be animated, which can lead to unexpected animations.
To fix, we're wrapping route children with `"none"` so each page can control its own animation:
@@ -2477,7 +2476,7 @@ To fix, we're wrapping route children with `"none"` so each page can control its
```
-In practice, navigations should be done via "enter" and "exit" props, or by using Transition Types.
+In practice, navigations should be done via "enter" and "exit" props, or by using Transition Types.
@@ -2512,7 +2511,7 @@ Now, the cross fade is slower:
```js src/App.js active
-import { unstable_ViewTransition as ViewTransition } from "react";
+import { ViewTransition } from "react";
import Details from "./Details";
import Home from "./Home";
import { useRouter } from "./router";
@@ -2778,7 +2777,7 @@ export function IconSearch(props) {
```
```js src/Layout.js hidden
-import {unstable_ViewTransition as ViewTransition} from 'react'; import { useIsNavPending } from "./router";
+import {ViewTransition} from 'react'; import { useIsNavPending } from "./router";
export default function Page({ heading, children }) {
const isPending = useIsNavPending();
@@ -3671,8 +3670,8 @@ root.render(
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "canary",
+ "react-dom": "canary",
"react-scripts": "latest"
},
"scripts": {
@@ -3705,7 +3704,7 @@ Now the video thumbnail animates between the two pages:
```js src/App.js
-import { unstable_ViewTransition as ViewTransition } from "react";
+import { ViewTransition } from "react";
import Details from "./Details";
import Home from "./Home";
import { useRouter } from "./router";
@@ -3972,7 +3971,7 @@ export function IconSearch(props) {
```
```js src/Layout.js hidden
-import {unstable_ViewTransition as ViewTransition} from 'react'; import { useIsNavPending } from "./router";
+import {ViewTransition} from 'react'; import { useIsNavPending } from "./router";
export default function Page({ heading, children }) {
const isPending = useIsNavPending();
@@ -4029,7 +4028,7 @@ export default function LikeButton({video}) {
```
```js src/Videos.js active
-import { useState, unstable_ViewTransition as ViewTransition } from "react"; import LikeButton from "./LikeButton"; import { useRouter } from "./router"; import { PauseIcon, PlayIcon } from "./Icons"; import { startTransition } from "react";
+import { useState, ViewTransition } from "react"; import LikeButton from "./LikeButton"; import { useRouter } from "./router"; import { PauseIcon, PlayIcon } from "./Icons"; import { startTransition } from "react";
export function Thumbnail({ video, children }) {
// Add a name to animate with a shared element transition.
@@ -4880,8 +4879,8 @@ root.render(
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "canary",
+ "react-dom": "canary",
"react-scripts": "latest"
},
"scripts": {
@@ -4962,7 +4961,7 @@ Now we can animate the header along with thumbnail based on navigation type:
```js src/App.js hidden
-import { unstable_ViewTransition as ViewTransition } from "react";
+import { ViewTransition } from "react";
import Details from "./Details";
import Home from "./Home";
import { useRouter } from "./router";
@@ -5227,7 +5226,7 @@ export function IconSearch(props) {
```
```js src/Layout.js active
-import {unstable_ViewTransition as ViewTransition} from 'react'; import { useIsNavPending } from "./router";
+import {ViewTransition} from 'react'; import { useIsNavPending } from "./router";
export default function Page({ heading, children }) {
const isPending = useIsNavPending();
@@ -5291,7 +5290,7 @@ export default function LikeButton({video}) {
```
```js src/Videos.js hidden
-import { useState, unstable_ViewTransition as ViewTransition } from "react";
+import { useState, ViewTransition } from "react";
import LikeButton from "./LikeButton";
import { useRouter } from "./router";
import { PauseIcon, PlayIcon } from "./Icons";
@@ -5442,11 +5441,11 @@ export function fetchVideoDetails(id) {
```
```js src/router.js
-import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, unstable_addTransitionType as addTransitionType} from "react";
+import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, addTransitionType} from "react";
export function Router({ children }) {
const [isPending, startTransition] = useTransition();
-
+
function navigate(url) {
startTransition(() => {
// Transition type for the cause "nav forward"
@@ -5473,7 +5472,7 @@ export function Router({ children }) {
},
});
}
-
+
useEffect(() => {
function handlePopState() {
// This should not animate because restoration has to be synchronous.
@@ -6196,8 +6195,8 @@ root.render(
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "canary",
+ "react-dom": "canary",
"react-scripts": "latest"
},
"scripts": {
@@ -6213,7 +6212,7 @@ root.render(
### Animating Suspense Boundaries {/*animating-suspense-boundaries*/}
-Suspense will also activate View Transitions.
+Suspense will also activate View Transitions.
To animate the fallback to content, we can wrap `Suspense` with ``:
@@ -6230,7 +6229,7 @@ By adding this, the fallback will cross-fade into the content. Click a video and
```js src/App.js hidden
-import { unstable_ViewTransition as ViewTransition } from "react";
+import { ViewTransition } from "react";
import Details from "./Details";
import Home from "./Home";
import { useRouter } from "./router";
@@ -6248,7 +6247,7 @@ export default function App() {
```
```js src/Details.js active
-import { use, Suspense, unstable_ViewTransition as ViewTransition } from "react"; import { fetchVideo, fetchVideoDetails } from "./data"; import { Thumbnail, VideoControls } from "./Videos"; import { useRouter } from "./router"; import Layout from "./Layout"; import { ChevronLeft } from "./Icons";
+import { use, Suspense, ViewTransition } from "react"; import { fetchVideo, fetchVideoDetails } from "./data"; import { Thumbnail, VideoControls } from "./Videos"; import { useRouter } from "./router"; import Layout from "./Layout"; import { ChevronLeft } from "./Icons";
function VideoDetails({ id }) {
// Cross-fade the fallback to content.
@@ -6498,7 +6497,7 @@ export function IconSearch(props) {
```
```js src/Layout.js hidden
-import {unstable_ViewTransition as ViewTransition} from 'react';
+import {ViewTransition} from 'react';
import { useIsNavPending } from "./router";
export default function Page({ heading, children }) {
@@ -6563,7 +6562,7 @@ export default function LikeButton({video}) {
```
```js src/Videos.js hidden
-import { useState, unstable_ViewTransition as ViewTransition } from "react";
+import { useState, ViewTransition } from "react";
import LikeButton from "./LikeButton";
import { useRouter } from "./router";
import { PauseIcon, PlayIcon } from "./Icons";
@@ -6714,7 +6713,7 @@ export function fetchVideoDetails(id) {
```
```js src/router.js hidden
-import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, unstable_addTransitionType as addTransitionType} from "react";
+import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, addTransitionType} from "react";
export function Router({ children }) {
const [isPending, startTransition] = useTransition();
@@ -6742,7 +6741,7 @@ export function Router({ children }) {
},
});
}
-
+
useEffect(() => {
function handlePopState() {
// This should not animate because restoration has to be synchronous.
@@ -7494,8 +7493,8 @@ root.render(
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "canary",
+ "react-dom": "canary",
"react-scripts": "latest"
},
"scripts": {
@@ -7528,7 +7527,7 @@ We can also provide custom animations using an `exit` on the fallback, and `ente
Here's how we'll define `slide-down` and `slide-up` with CSS:
```css {1, 6}
-::view-transition-old(.slide-down) {
+::view-transition-old(.slide-down) {
/* Slide the fallback down */
animation: ...;
}
@@ -7544,7 +7543,7 @@ Now, the Suspense content replaces the fallback with a sliding animation:
```js src/App.js hidden
-import { unstable_ViewTransition as ViewTransition } from "react";
+import { ViewTransition } from "react";
import Details from "./Details";
import Home from "./Home";
import { useRouter } from "./router";
@@ -7562,7 +7561,7 @@ export default function App() {
```
```js src/Details.js active
-import { use, Suspense, unstable_ViewTransition as ViewTransition } from "react"; import { fetchVideo, fetchVideoDetails } from "./data"; import { Thumbnail, VideoControls } from "./Videos"; import { useRouter } from "./router"; import Layout from "./Layout"; import { ChevronLeft } from "./Icons";
+import { use, Suspense, ViewTransition } from "react"; import { fetchVideo, fetchVideoDetails } from "./data"; import { Thumbnail, VideoControls } from "./Videos"; import { useRouter } from "./router"; import Layout from "./Layout"; import { ChevronLeft } from "./Icons";
function VideoDetails({ id }) {
return (
@@ -7819,7 +7818,7 @@ export function IconSearch(props) {
```
```js src/Layout.js hidden
-import {unstable_ViewTransition as ViewTransition} from 'react';
+import {ViewTransition} from 'react';
import { useIsNavPending } from "./router";
export default function Page({ heading, children }) {
@@ -7884,7 +7883,7 @@ export default function LikeButton({video}) {
```
```js src/Videos.js hidden
-import { useState, unstable_ViewTransition as ViewTransition } from "react";
+import { useState, ViewTransition } from "react";
import LikeButton from "./LikeButton";
import { useRouter } from "./router";
import { PauseIcon, PlayIcon } from "./Icons";
@@ -8035,7 +8034,7 @@ export function fetchVideoDetails(id) {
```
```js src/router.js hidden
-import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, unstable_addTransitionType as addTransitionType} from "react";
+import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, addTransitionType} from "react";
export function Router({ children }) {
const [isPending, startTransition] = useTransition();
@@ -8063,7 +8062,7 @@ export function Router({ children }) {
},
});
}
-
+
useEffect(() => {
function handlePopState() {
// This should not animate because restoration has to be synchronous.
@@ -8815,8 +8814,8 @@ root.render(
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "canary",
+ "react-dom": "canary",
"react-scripts": "latest"
},
"scripts": {
@@ -8858,7 +8857,7 @@ Now the items animate as you type in the search bar:
```js src/App.js hidden
-import { unstable_ViewTransition as ViewTransition } from "react";
+import { ViewTransition } from "react";
import Details from "./Details";
import Home from "./Home";
import { useRouter } from "./router";
@@ -8876,7 +8875,7 @@ export default function App() {
```
```js src/Details.js hidden
-import { use, Suspense, unstable_ViewTransition as ViewTransition } from "react";
+import { use, Suspense, ViewTransition } from "react";
import { fetchVideo, fetchVideoDetails } from "./data";
import { Thumbnail, VideoControls } from "./Videos";
import { useRouter } from "./router";
@@ -8951,17 +8950,17 @@ function VideoInfo({ id }) {
```
```js src/Home.js
-import { useId, useState, use, useDeferredValue, unstable_ViewTransition as ViewTransition } from "react";import { Video } from "./Videos";import Layout from "./Layout";import { fetchVideos } from "./data";import { IconSearch } from "./Icons";
+import { useId, useState, use, useDeferredValue, ViewTransition } from "react";import { Video } from "./Videos";import Layout from "./Layout";import { fetchVideos } from "./data";import { IconSearch } from "./Icons";
function SearchList({searchText, videos}) {
- // Activate with useDeferredValue ("when")
+ // Activate with useDeferredValue ("when")
const deferredSearchText = useDeferredValue(searchText);
const filteredVideos = filterVideos(videos, deferredSearchText);
return (
{filteredVideos.map((video) => (
- // Animate each item in list ("what")
+ // Animate each item in list ("what")
@@ -8978,7 +8977,7 @@ export default function Home() {
const videos = use(fetchVideos());
const count = videos.length;
const [searchText, setSearchText] = useState('');
-
+
return (
{count} Videos
}>
@@ -9146,7 +9145,7 @@ export function IconSearch(props) {
```
```js src/Layout.js hidden
-import {unstable_ViewTransition as ViewTransition} from 'react';
+import {ViewTransition} from 'react';
import { useIsNavPending } from "./router";
export default function Page({ heading, children }) {
@@ -9211,7 +9210,7 @@ export default function LikeButton({video}) {
```
```js src/Videos.js hidden
-import { useState, unstable_ViewTransition as ViewTransition } from "react";
+import { useState, ViewTransition } from "react";
import LikeButton from "./LikeButton";
import { useRouter } from "./router";
import { PauseIcon, PlayIcon } from "./Icons";
@@ -9362,7 +9361,7 @@ export function fetchVideoDetails(id) {
```
```js src/router.js hidden
-import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, unstable_addTransitionType as addTransitionType} from "react";
+import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, addTransitionType} from "react";
export function Router({ children }) {
const [isPending, startTransition] = useTransition();
@@ -9390,7 +9389,7 @@ export function Router({ children }) {
},
});
}
-
+
useEffect(() => {
function handlePopState() {
// This should not animate because restoration has to be synchronous.
@@ -10156,8 +10155,8 @@ root.render(
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "canary",
+ "react-dom": "canary",
"react-scripts": "latest"
},
"scripts": {
@@ -10182,7 +10181,7 @@ Let's remove the slow fade, and take a look at the final result:
```js src/App.js
-import {unstable_ViewTransition as ViewTransition} from 'react'; import Details from './Details'; import Home from './Home'; import {useRouter} from './router';
+import {ViewTransition} from 'react'; import Details from './Details'; import Home from './Home'; import {useRouter} from './router';
export default function App() {
const {url} = useRouter();
@@ -10197,7 +10196,7 @@ export default function App() {
```
```js src/Details.js
-import { use, Suspense, unstable_ViewTransition as ViewTransition } from "react"; import { fetchVideo, fetchVideoDetails } from "./data"; import { Thumbnail, VideoControls } from "./Videos"; import { useRouter } from "./router"; import Layout from "./Layout"; import { ChevronLeft } from "./Icons";
+import { use, Suspense, ViewTransition } from "react"; import { fetchVideo, fetchVideoDetails } from "./data"; import { Thumbnail, VideoControls } from "./Videos"; import { useRouter } from "./router"; import Layout from "./Layout"; import { ChevronLeft } from "./Icons";
function VideoDetails({id}) {
// Animate from Suspense fallback to content
@@ -10267,17 +10266,17 @@ function VideoInfo({ id }) {
```
```js src/Home.js
-import { useId, useState, use, useDeferredValue, unstable_ViewTransition as ViewTransition } from "react";import { Video } from "./Videos";import Layout from "./Layout";import { fetchVideos } from "./data";import { IconSearch } from "./Icons";
+import { useId, useState, use, useDeferredValue, ViewTransition } from "react";import { Video } from "./Videos";import Layout from "./Layout";import { fetchVideos } from "./data";import { IconSearch } from "./Icons";
function SearchList({searchText, videos}) {
- // Activate with useDeferredValue ("when")
+ // Activate with useDeferredValue ("when")
const deferredSearchText = useDeferredValue(searchText);
const filteredVideos = filterVideos(videos, deferredSearchText);
return (
{filteredVideos.map((video) => (
- // Animate each item in list ("what")
+ // Animate each item in list ("what")
@@ -10294,7 +10293,7 @@ export default function Home() {
const videos = use(fetchVideos());
const count = videos.length;
const [searchText, setSearchText] = useState('');
-
+
return (
{count} Videos
}>
@@ -10462,7 +10461,7 @@ export function IconSearch(props) {
```
```js src/Layout.js
-import {unstable_ViewTransition as ViewTransition} from 'react'; import { useIsNavPending } from "./router";
+import {ViewTransition} from 'react'; import { useIsNavPending } from "./router";
export default function Page({ heading, children }) {
const isPending = useIsNavPending();
@@ -10526,7 +10525,7 @@ export default function LikeButton({video}) {
```
```js src/Videos.js
-import { useState, unstable_ViewTransition as ViewTransition } from "react"; import LikeButton from "./LikeButton"; import { useRouter } from "./router"; import { PauseIcon, PlayIcon } from "./Icons"; import { startTransition } from "react";
+import { useState, ViewTransition } from "react"; import LikeButton from "./LikeButton"; import { useRouter } from "./router"; import { PauseIcon, PlayIcon } from "./Icons"; import { startTransition } from "react";
export function Thumbnail({ video, children }) {
// Add a name to animate with a shared element transition.
@@ -10674,7 +10673,7 @@ export function fetchVideoDetails(id) {
```
```js src/router.js
-import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, unstable_addTransitionType as addTransitionType} from "react";
+import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, addTransitionType} from "react";
export function Router({ children }) {
const [isPending, startTransition] = useTransition();
@@ -10694,7 +10693,7 @@ export function Router({ children }) {
}
const [routerState, setRouterState] = useState({pendingNav: () => {}, url: document.location.pathname});
-
+
function go(url) {
setRouterState({
url,
@@ -10703,7 +10702,7 @@ export function Router({ children }) {
},
});
}
-
+
useEffect(() => {
function handlePopState() {
// This should not animate because restoration has to be synchronous.
@@ -11442,8 +11441,8 @@ root.render(
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "canary",
+ "react-dom": "canary",
"react-scripts": "latest"
},
"scripts": {
@@ -11508,7 +11507,7 @@ When a user navigates away from a page, it's common to stop rendering the old pa
```js {6,7}
function App() {
const { url } = useRouter();
-
+
return (
<>
{url === '/' && }
@@ -11525,7 +11524,7 @@ Activity allows you to keep the state around as the user changes pages, so when
```js {6-8}
function App() {
const { url } = useRouter();
-
+
return (
<>
@@ -11544,11 +11543,11 @@ 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 { 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();
-
+
return (
// View Transitions know about Activity
@@ -11563,7 +11562,7 @@ export default function App() {
```
```js src/Details.js hidden
-import { use, Suspense, unstable_ViewTransition as ViewTransition } from "react";
+import { use, Suspense, ViewTransition } from "react";
import { fetchVideo, fetchVideoDetails } from "./data";
import { Thumbnail, VideoControls } from "./Videos";
import { useRouter } from "./router";
@@ -11638,10 +11637,10 @@ function VideoInfo({ id }) {
```
```js src/Home.js hidden
-import { useId, useState, use, useDeferredValue, unstable_ViewTransition as ViewTransition } from "react";import { Video } from "./Videos";import Layout from "./Layout";import { fetchVideos } from "./data";import { IconSearch } from "./Icons";
+import { useId, useState, use, useDeferredValue, ViewTransition } from "react";import { Video } from "./Videos";import Layout from "./Layout";import { fetchVideos } from "./data";import { IconSearch } from "./Icons";
function SearchList({searchText, videos}) {
- // Activate with useDeferredValue ("when")
+ // Activate with useDeferredValue ("when")
const deferredSearchText = useDeferredValue(searchText);
const filteredVideos = filterVideos(videos, deferredSearchText);
return (
@@ -11651,7 +11650,7 @@ function SearchList({searchText, videos}) {
)}
{filteredVideos.map((video) => (
- // Animate each item in list ("what")
+ // Animate each item in list ("what")
@@ -11665,7 +11664,7 @@ export default function Home() {
const videos = use(fetchVideos());
const count = videos.length;
const [searchText, setSearchText] = useState('');
-
+
return (
{count} Videos
}>
@@ -11833,7 +11832,7 @@ export function IconSearch(props) {
```
```js src/Layout.js hidden
-import {unstable_ViewTransition as ViewTransition} from 'react'; import { useIsNavPending } from "./router";
+import {ViewTransition} from 'react'; import { useIsNavPending } from "./router";
export default function Page({ heading, children }) {
const isPending = useIsNavPending();
@@ -11897,7 +11896,7 @@ export default function LikeButton({video}) {
```
```js src/Videos.js hidden
-import { useState, unstable_ViewTransition as ViewTransition } from "react";
+import { useState, ViewTransition } from "react";
import LikeButton from "./LikeButton";
import { useRouter } from "./router";
import { PauseIcon, PlayIcon } from "./Icons";
@@ -12048,7 +12047,7 @@ export function fetchVideoDetails(id) {
```
```js src/router.js hidden
-import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, unstable_addTransitionType as addTransitionType} from "react";
+import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, addTransitionType} from "react";
export function Router({ children }) {
const [isPending, startTransition] = useTransition();
@@ -12076,7 +12075,7 @@ export function Router({ children }) {
},
});
}
-
+
useEffect(() => {
function handlePopState() {
// This should not animate because restoration has to be synchronous.
@@ -12841,8 +12840,8 @@ root.render(
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "canary",
+ "react-dom": "canary",
"react-scripts": "latest"
},
"scripts": {
@@ -12881,13 +12880,13 @@ 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 { 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();
const videoId = url.split("/").pop();
const videos = use(fetchVideos());
-
+
return (
{/* Render videos in Activity to pre-render them */}
@@ -12905,7 +12904,7 @@ export default function App() {
```
```js src/Details.js
-import { use, Suspense, unstable_ViewTransition as ViewTransition } from "react"; import { fetchVideo, fetchVideoDetails } from "./data"; import { Thumbnail, VideoControls } from "./Videos"; import { useRouter } from "./router"; import Layout from "./Layout"; import { ChevronLeft } from "./Icons";
+import { use, Suspense, ViewTransition } from "react"; import { fetchVideo, fetchVideoDetails } from "./data"; import { Thumbnail, VideoControls } from "./Videos"; import { useRouter } from "./router"; import Layout from "./Layout"; import { ChevronLeft } from "./Icons";
function VideoDetails({id}) {
// Animate from Suspense fallback to content.
@@ -12976,10 +12975,10 @@ function VideoInfo({ id }) {
```
```js src/Home.js hidden
-import { useId, useState, use, useDeferredValue, unstable_ViewTransition as ViewTransition } from "react";import { Video } from "./Videos";import Layout from "./Layout";import { fetchVideos } from "./data";import { IconSearch } from "./Icons";
+import { useId, useState, use, useDeferredValue, ViewTransition } from "react";import { Video } from "./Videos";import Layout from "./Layout";import { fetchVideos } from "./data";import { IconSearch } from "./Icons";
function SearchList({searchText, videos}) {
- // Activate with useDeferredValue ("when")
+ // Activate with useDeferredValue ("when")
const deferredSearchText = useDeferredValue(searchText);
const filteredVideos = filterVideos(videos, deferredSearchText);
return (
@@ -12989,7 +12988,7 @@ function SearchList({searchText, videos}) {
)}
{filteredVideos.map((video) => (
- // Animate each item in list ("what")
+ // Animate each item in list ("what")
@@ -13003,7 +13002,7 @@ export default function Home() {
const videos = use(fetchVideos());
const count = videos.length;
const [searchText, setSearchText] = useState('');
-
+
return (
{count} Videos
}>
@@ -13171,7 +13170,7 @@ export function IconSearch(props) {
```
```js src/Layout.js hidden
-import {unstable_ViewTransition as ViewTransition} from 'react'; import { useIsNavPending } from "./router";
+import {ViewTransition} from 'react'; import { useIsNavPending } from "./router";
export default function Page({ heading, children }) {
const isPending = useIsNavPending();
@@ -13235,7 +13234,7 @@ export default function LikeButton({video}) {
```
```js src/Videos.js hidden
-import { useState, unstable_ViewTransition as ViewTransition } from "react";
+import { useState, ViewTransition } from "react";
import LikeButton from "./LikeButton";
import { useRouter } from "./router";
import { PauseIcon, PlayIcon } from "./Icons";
@@ -13386,7 +13385,7 @@ export function fetchVideoDetails(id) {
```
```js src/router.js hidden
-import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, unstable_addTransitionType as addTransitionType} from "react";
+import {useState, createContext, use, useTransition, useLayoutEffect, useEffect, addTransitionType} from "react";
export function Router({ children }) {
const [isPending, startTransition] = useTransition();
@@ -13414,7 +13413,7 @@ export function Router({ children }) {
},
});
}
-
+
useEffect(() => {
function handlePopState() {
// This should not animate because restoration has to be synchronous.
@@ -14179,8 +14178,8 @@ root.render(
```json package.json hidden
{
"dependencies": {
- "react": "experimental",
- "react-dom": "experimental",
+ "react": "canary",
+ "react-dom": "canary",
"react-scripts": "latest"
},
"scripts": {
@@ -14220,13 +14219,13 @@ These are areas we're still exploring, and we'll share more as we make progress.
# Features in development {/*features-in-development*/}
-We're also developing features to help solve the common problems below.
+We're also developing features to help solve the common problems below.
-As we iterate on possible solutions, you may see some potential APIs we're testing being shared based on the PRs we are landing. Please keep in mind that as we try different ideas, we often change or remove different solutions after trying them out.
+As we iterate on possible solutions, you may see some potential APIs we're testing being shared based on the PRs we are landing. Please keep in mind that as we try different ideas, we often change or remove different solutions after trying them out.
-When the solutions we're working on are shared too early, it can create churn and confusion in the community. To balance being transparent and limiting confusion, we're sharing the problems we're currently developing solutions for, without sharing a particular solution we have in mind.
+When the solutions we're working on are shared too early, it can create churn and confusion in the community. To balance being transparent and limiting confusion, we're sharing the problems we're currently developing solutions for, without sharing a particular solution we have in mind.
-As these features progress, we'll announce them on the blog with docs included so you can try them out.
+As these features progress, we'll announce them on the blog with docs included so you can try them out.
## React Performance Tracks {/*react-performance-tracks*/}
@@ -14259,7 +14258,7 @@ When we released hooks, we had three motivations:
- **Think in terms of function, not lifecycles**: hooks let you split one component into smaller functions based on what pieces are related (such as setting up a subscription or fetching data), rather than forcing a split based on lifecycle methods.
- **Support ahead-of-time compilation**: hooks were designed to support ahead-of-time compilation with less pitfalls causing unintentional de-optimizations caused by lifecycle methods, and limitations of classes.
-Since their release, hooks have been successful at *sharing code between components*. Hooks are now the favored way to share logic between components, and there are less use cases for render props and higher order components. Hooks have also been successful at supporting features like Fast Refresh that were not possible with class components.
+Since their release, hooks have been successful at *sharing code between components*. Hooks are now the favored way to share logic between components, and there are less use cases for render props and higher order components. Hooks have also been successful at supporting features like Fast Refresh that were not possible with class components.
### Effects can be hard {/*effects-can-be-hard*/}
@@ -14300,18 +14299,18 @@ useEffect(() => {
return () => {
connection.disconnect();
};
-}); // compiler inserted dependencies.
+}); // 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.
+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.
---
## Compiler IDE Extension {/*compiler-ide-extension*/}
-Earlier this week [we shared](/blog/2025/04/21/react-compiler-rc) the React Compiler release candidate, and we're working towards shipping the first SemVer stable version of the compiler in the coming months.
+Later in 2025 [we shared](/blog/2025/10/07/react-compiler-1) the first stable release of React Compiler, and we're continuing to invest in shipping more improvements.
We've also begun exploring ways to use the React Compiler to provide information that can improve understanding and debugging your code. One idea we've started exploring is a new experimental LSP-based React IDE extension powered by React Compiler, similar to the extension used in [Lauren Tan's React Conf talk](https://conf2024.react.dev/talks/5).
@@ -14333,7 +14332,7 @@ Fragment refs are still being researched. We'll share more when we're closer to
## Gesture Animations {/*gesture-animations*/}
-We're also researching ways to enhance View Transitions to support gesture animations such as swiping to open a menu, or scroll through a photo carousel.
+We're also researching ways to enhance View Transitions to support gesture animations such as swiping to open a menu, or scroll through a photo carousel.
Gestures present new challenges for a few reasons:
@@ -14357,9 +14356,9 @@ Now that React 19 has shipped, we're revisiting this problem space to create a p
const value = use(store);
```
-Our goal is to allow external state to be read during render without tearing, and to work seamlessly with all of the concurrent features React offers.
+Our goal is to allow external state to be read during render without tearing, and to work seamlessly with all of the concurrent features React offers.
-This research is still early. We'll share more, and what the new APIs will look like, when we're further along.
+This research is still early. We'll share more, and what the new APIs will look like, when we're further along.
---
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..51c30f70a
--- /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@latest` 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 Components 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 [Components 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@latest` 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#recommended).
+
+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/2025/10/07/introducing-the-react-foundation.md b/src/content/blog/2025/10/07/introducing-the-react-foundation.md
new file mode 100644
index 000000000..a9b922dbc
--- /dev/null
+++ b/src/content/blog/2025/10/07/introducing-the-react-foundation.md
@@ -0,0 +1,67 @@
+---
+title: "Introducing the React Foundation"
+author: Seth Webster, Matt Carroll, Joe Savona
+date: 2025/10/07
+description: Today, we're announcing our plans to create the React Foundation a new technical governance structure
+---
+
+October 7, 2025 by [Seth Webster](https://x.com/sethwebster), [Matt Carroll](https://x.com/mattcarrollcode), [Joe Savona](https://x.com/en_JS), [Sophie Alpert](https://x.com/sophiebits)
+
+---
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Today, we're announcing our plans to create the React Foundation and a new technical governance structure.
+
+
+
+---
+
+We open sourced React over a decade ago to help developers build great user experiences. From its earliest days, React has received substantial contributions from contributors outside of Meta. Over time, the number of contributors and the scope of their contributions has grown significantly. What started out as a tool developed for Meta has expanded into a project that spans multiple companies with regular contributions from across the ecosystem. React has outgrown the confines of any one company.
+
+To better serve the React community, we are announcing our plans to move React and React Native from Meta to a new React Foundation. As a part of this change, we will also be implementing a new independent technical governance structure. We believe these changes will enable us to give React ecosystem projects more resources.
+
+## The React Foundation {/*the-react-foundation*/}
+
+We will make the React Foundation the new home for React, React Native, and some supporting projects like JSX. The React Foundation’s mission will be to support the React community and ecosystem. Once implemented, the React Foundation will
+
+* Maintain React’s infrastructure like GitHub, CI, and trademarks
+* Organize React Conf
+* Create initiatives to support the React ecosystem like financial support of ecosystem projects, issuing grants, and creating programs
+
+The React Foundation will be governed by a board of directors, with Seth Webster serving as the executive director. This board will direct funds and resources to support React’s development, community, and ecosystem. We believe that this is the best structure to ensure that the React Foundation is vendor-neutral and reflects the best interests of the community.
+
+The founding corporate members of the React Foundation will be Amazon, Callstack, Expo, Meta, Microsoft, Software Mansion, and Vercel. These companies have had a major impact on the React and React Native ecosystems and we are grateful for their support. We are excited to welcome even more members in the future.
+
+
+
+
+
+
+
+
+
+
+
+
+## React’s technical governance {/*reacts-technical-governance*/}
+
+We believe that React's technical direction should be set by the people who contribute to and maintain React. As React moves to a foundation, it is important that no single company or organization is overrepresented. To achieve this, we plan to define a new technical governance structure for React that is independent from the React Foundation.
+
+As a part of creating React’s new technical governance structure we will reach out to the community for feedback. Once finalized, we will share details in a future post.
+
+## Thank you {/*thank-you*/}
+
+React's incredible growth is thanks to the thousands of people, companies, and projects that have shaped React. The creation of the React Foundation is a testament to the strength and vibrancy of the React community. Together, the React Foundation and React’s new technical governance will ensure that React’s future is secure for years to come.
diff --git a/src/content/blog/2025/10/07/react-compiler-1.md b/src/content/blog/2025/10/07/react-compiler-1.md
new file mode 100644
index 000000000..5474c50d3
--- /dev/null
+++ b/src/content/blog/2025/10/07/react-compiler-1.md
@@ -0,0 +1,194 @@
+---
+title: "React Compiler v1.0"
+author: Lauren Tan, Joe Savona, and Mofei Zhang
+date: 2025/10/07
+description: We are releasing the compiler's first stable release today.
+
+---
+
+Oct 7, 2025 by [Lauren Tan](https://x.com/potetotes), [Joe Savona](https://x.com/en_JS), and [Mofei Zhang](https://x.com/zmofei).
+
+---
+
+
+
+The React team is excited to share new updates:
+
+
+
+1. React Compiler 1.0 is available today.
+2. Compiler-powered lint rules ship in `eslint-plugin-react-hooks`'s `recommended` and `recommended-latest` preset.
+3. We've published an incremental adoption guide, and partnered with Expo, Vite, and Next.js so new apps can start with the compiler enabled.
+
+---
+
+We are releasing the compiler's first stable release today. React Compiler works on both React and React Native, and automatically optimizes components and hooks without requiring rewrites. The compiler has been battle tested on major apps at Meta and is fully production-ready.
+
+[React Compiler](/learn/react-compiler) is a build-time tool that optimizes your React app through automatic memoization. Last year, we published React Compiler's [first beta](/blog/2024/10/21/react-compiler-beta-release) and received lots of great feedback and contributions. We're excited about the wins we've seen from folks adopting the compiler (see case studies from [Sanity Studio](https://github.com/reactwg/react-compiler/discussions/33) and [Wakelet](https://github.com/reactwg/react-compiler/discussions/52)) and are excited to bring the compiler to more users in the React community.
+
+This release is the culmination of a huge and complex engineering effort spanning almost a decade. The React team's first exploration into compilers started with [Prepack](https://github.com/facebookarchive/prepack) in 2017. While this project was eventually shut down, there were many learnings that informed the team on the design of Hooks, which were designed with a future compiler in mind. In 2021, [Xuan Huang](https://x.com/Huxpro) demoed the [first iteration](https://www.youtube.com/watch?v=lGEMwh32soc) of a new take on React Compiler.
+
+Although this first version of the new React Compiler was eventually rewritten, the first prototype gave us increased confidence that this was a tractable problem, and the learnings that an alternative compiler architecture could precisely give us the memoization characteristics we wanted. [Joe Savona](https://x.com/en_JS), [Sathya Gunasekaran](https://x.com/_gsathya), [Mofei Zhang](https://x.com/zmofei), and [Lauren Tan](https://x.com/potetotes) worked through our first rewrite, moving the compiler's architecture into a Control Flow Graph (CFG) based High-Level Intermediate Representation (HIR). This paved the way for much more precise analysis and even type inference within React Compiler. Since then, many significant portions of the compiler have been rewritten, with each rewrite informed by our learnings from the previous attempt. And we have received significant help and contributions from many members of the [React team](/community/team) along the way.
+
+This stable release is our first of many. The compiler will continue to evolve and improve, and we expect to see it become a new foundation and era for the next decade and more of React.
+
+You can jump straight to the [quickstart](/learn/react-compiler), or read on for the highlights from React Conf 2025.
+
+
+
+#### How does React Compiler work? {/*how-does-react-compiler-work*/}
+
+React Compiler is an optimizing compiler that optimizes components and hooks through automatic memoization. While it is implemented as a Babel plugin currently, the compiler is largely decoupled from Babel and lowers the Abstract Syntax Tree (AST) provided by Babel into its own novel HIR, and through multiple compiler passes, carefully understands data-flow and mutability of your React code. This allows the compiler to granularly memoize values used in rendering, including the ability to memoize conditionally, which is not possible through manual memoization.
+
+```js {8}
+import { use } from 'react';
+
+export default function ThemeProvider(props) {
+ if (!props.children) {
+ return null;
+ }
+ // The compiler can still memoize code after a conditional return
+ const theme = mergeTheme(props.theme, use(ThemeContext));
+ return (
+
+ {props.children}
+
+ );
+}
+```
+_See this example in the [React Compiler Playground](https://playground.react.dev/#N4Igzg9grgTgxgUxALhASwLYAcIwC4AEwBUYCBAvgQGYwQYEDkMCAhnHowNwA6AdvwQAPHPgIATBNVZQANoWpQ+HNBD4EAKgAsEGBAAU6ANzSSYACix0sYAJRF+BAmmoFzAQisQbAOjha0WXEWPntgRycCFjxYdT45WV51Sgi4NTBCPB09AgBeAj0YAHMEbV0ES2swHyzygBoSMnMyvQBhNTxhPFtbJKdo2LcIpwAeFoR2vk6hQiNWWSgEXOBavQoAPmHI4C9ff0DghD4KLZGAenHJ6bxN5N7+ChA6kDS+ajQilHRsXEyATyw5GI+gWRTQfAA8lg8Ko+GBKDQ6AxGAAjVgohCyAC0WFB4KxLHYeCxaWwgQQMDO4jQGW4-H45nCyTOZ1JWECrBhagAshBJMgCDwQPNZEKHgQwJyae8EPCQVAwZDobC7FwnuAtBAAO4ASSmFL48zAKGksjIFCAA)_
+
+In addition to automatic memoization, React Compiler also has validation passes that run on your React code. These passes encode the [Rules of React](/reference/rules), and uses the compiler's understanding of data-flow and mutability to provide diagnostics where the Rules of React are broken. These diagnostics often expose latent bugs hiding in React code, and are primarily surfaced through `eslint-plugin-react-hooks`.
+
+To learn more about how the compiler optimizes your code, visit the [Playground](https://playground.react.dev).
+
+
+
+## Use React Compiler Today {/*use-react-compiler-today*/}
+To install the compiler:
+
+npm
+
+{`npm install --save-dev --save-exact babel-plugin-react-compiler@latest`}
+
+
+pnpm
+
+{`pnpm add --save-dev --save-exact babel-plugin-react-compiler@latest`}
+
+
+yarn
+
+{`yarn add --dev --exact babel-plugin-react-compiler@latest`}
+
+
+As part of the stable release, we've been making React Compiler easier to add to your projects and added optimizations to how the compiler generates memoization. React Compiler now supports optional chains and array indices as dependencies. These improvements ultimately result in fewer re-renders and more responsive UIs, while letting you keep writing idiomatic declarative code.
+
+You can find more details on using the Compiler in [our docs](/learn/react-compiler).
+
+## What we're seeing in production {/*react-compiler-at-meta*/}
+[The compiler has already shipped in apps like Meta Quest Store](https://youtu.be/lyEKhv8-3n0?t=3002). We've seen initial loads and cross-page navigations improve by up to 12%, while certain interactions are more than 2.5× faster. Memory usage stays neutral even with these wins. Although your mileage may vary, we recommend experimenting with the compiler in your app to see similar performance gains.
+
+## Backwards Compatibility {/*backwards-compatibility*/}
+As noted in the Beta announcement, React Compiler is compatible with React 17 and up. If you are not yet on React 19, you can use React Compiler by specifying a minimum target in your compiler config, and adding `react-compiler-runtime` as a dependency. You can find docs on this [here](/reference/react-compiler/target#targeting-react-17-or-18).
+
+## Enforce the Rules of React with compiler-powered linting {/*migrating-from-eslint-plugin-react-compiler-to-eslint-plugin-react-hooks*/}
+React Compiler includes an ESLint rule that helps identify code that breaks the [Rules of React](/reference/rules). The linter does not require the compiler to be installed, so there's no risk in upgrading eslint-plugin-react-hooks. We recommend everyone upgrade today.
+
+If you have already installed `eslint-plugin-react-compiler`, you can now remove it and use `eslint-plugin-react-hooks@latest`. Many thanks to [@michaelfaith](https://bsky.app/profile/michael.faith) for contributing to this improvement!
+
+To install:
+
+npm
+
+{`npm install --save-dev eslint-plugin-react-hooks@latest`}
+
+
+pnpm
+
+{`pnpm add --save-dev eslint-plugin-react-hooks@latest`}
+
+
+yarn
+
+{`yarn add --dev eslint-plugin-react-hooks@latest`}
+
+
+```js {6}
+// eslint.config.js (Flat Config)
+import reactHooks from 'eslint-plugin-react-hooks';
+import { defineConfig } from 'eslint/config';
+
+export default defineConfig([
+ reactHooks.configs.flat.recommended,
+]);
+```
+
+```js {3}
+// eslintrc.json (Legacy Config)
+{
+ "extends": ["plugin:react-hooks/recommended"],
+ // ...
+}
+```
+
+To enable React Compiler rules, we recommend using the `recommended` preset. You can also check out the [README](https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/README.md) for more instructions. Here are a few examples we featured at React Conf:
+
+- Catching `setState` patterns that cause render loops with [`set-state-in-render`](/reference/eslint-plugin-react-hooks/lints/set-state-in-render).
+- Flagging expensive work inside effects via [`set-state-in-effect`](/reference/eslint-plugin-react-hooks/lints/set-state-in-effect).
+- Preventing unsafe ref access during render with [`refs`](/reference/eslint-plugin-react-hooks/lints/refs).
+
+## What should I do about useMemo, useCallback, and React.memo? {/*what-should-i-do-about-usememo-usecallback-and-reactmemo*/}
+By default, React Compiler will memoize your code based on its analysis and heuristics. In most cases, this memoization will be as precise, or moreso, than what you may have written — and as noted above, the compiler can memoize even in cases where `useMemo`/`useCallback` cannot be used, such as after an early return.
+
+However, in some cases developers may need more control over memoization. The `useMemo` and `useCallback` hooks can continue to be used with React Compiler as an escape hatch to provide control over which values are memoized. A common use-case for this is if a memoized value is used as an effect dependency, in order to ensure that an effect does not fire repeatedly even when its dependencies do not meaningfully change.
+
+For new code, we recommend relying on the compiler for memoization and using `useMemo`/`useCallback` where needed to achieve precise control.
+
+For existing code, we recommend either leaving existing memoization in place (removing it can change compilation output) or carefully testing before removing the memoization.
+
+## New apps should use React Compiler {/*new-apps-should-use-react-compiler*/}
+We have partnered with the Expo, Vite, and Next.js teams to add the compiler to the new app experience.
+
+[Expo SDK 54](https://docs.expo.dev/guides/react-compiler/) and up has the compiler enabled by default, so new apps will automatically be able to take advantage of the compiler from the start.
+
+
+{`npx create-expo-app@latest`}
+
+
+[Vite](https://vite.dev/guide/) and [Next.js](https://nextjs.org/docs/app/api-reference/cli/create-next-app) users can choose the compiler enabled templates in `create-vite` and `create-next-app`.
+
+
+{`npm create vite@latest`}
+
+
+
+
+
+{`npx create-next-app@latest`}
+
+
+## Adopt React Compiler incrementally {/*adopt-react-compiler-incrementally*/}
+If you're maintaining an existing application, you can roll out the compiler at your own pace. We published a step-by-step [incremental adoption guide](/learn/react-compiler/incremental-adoption) that covers gating strategies, compatibility checks, and rollout tooling so you can enable the compiler with confidence.
+
+## swc support (experimental) {/*swc-support-experimental*/}
+React Compiler can be installed across [several build tools](/learn/react-compiler#installation) such as Babel, Vite, and Rsbuild.
+
+In addition to those tools, we have been collaborating with Kang Dongyoon ([@kdy1dev](https://x.com/kdy1dev)) from the [swc](https://swc.rs/) team on adding additional support for React Compiler as an swc plugin. While this work isn't done, Next.js build performance should now be considerably faster when the [React Compiler is enabled in your Next.js app](https://nextjs.org/docs/app/api-reference/config/next-config-js/reactCompiler).
+
+We recommend using Next.js [15.3.1](https://github.com/vercel/next.js/releases/tag/v15.3.1) or greater to get the best build performance.
+
+Vite users can continue to use [vite-plugin-react](https://github.com/vitejs/vite-plugin-react) to enable the compiler, by adding it as a [Babel plugin](/learn/react-compiler/installation#vite). We are also working with the [oxc](https://oxc.rs/) team to [add support for the compiler](https://github.com/oxc-project/oxc/issues/10048). Once [rolldown](https://github.com/rolldown/rolldown) is officially released and supported in Vite and oxc support is added for React Compiler, we'll update the docs with information on how to migrate.
+
+## Upgrading React Compiler {/*upgrading-react-compiler*/}
+React Compiler works best when the auto-memoization applied is strictly for performance. Future versions of the compiler may change how memoization is applied, for example it could become more granular and precise.
+
+However, because product code may sometimes break the [rules of React](/reference/rules) in ways that aren't always statically detectable in JavaScript, changing memoization can occasionally have unexpected results. For example, a previously memoized value might be used as a dependency for a `useEffect` somewhere in the component tree. Changing how or whether this value is memoized can cause over or under-firing of that `useEffect`. While we encourage [useEffect only for synchronization](/learn/synchronizing-with-effects), your codebase may have `useEffect`s that cover other use cases, such as effects that needs to only run in response to specific values changing.
+
+In other words, changing memoization may under rare circumstances cause unexpected behavior. For this reason, we recommend following the Rules of React and employing continuous end-to-end testing of your app so you can upgrade the compiler with confidence and identify any rules of React violations that might cause issues.
+
+If you don't have good test coverage, we recommend pinning the compiler to an exact version (eg `1.0.0`) rather than a SemVer range (eg `^1.0.0`). You can do this by passing the `--save-exact` (npm/pnpm) or `--exact` flags (yarn) when upgrading the compiler. You should then do any upgrades of the compiler manually, taking care to check that your app still works as expected.
+
+---
+
+Thanks to [Jason Bonta](https://x.com/someextent), [Jimmy Lai](https://x.com/feedthejim), [Kang Dongyoon](https://x.com/kdy1dev) (@kdy1dev), and [Dan Abramov](https://bsky.app/profile/danabra.mov) for reviewing and editing this post.
diff --git a/src/content/blog/index.md b/src/content/blog/index.md
index a7a897634..a30542275 100644
--- a/src/content/blog/index.md
+++ b/src/content/blog/index.md
@@ -12,15 +12,27 @@ You can also follow the [@react.dev](https://bsky.app/profile/react.dev) account
-
+
-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 ...
+We're releasing the compiler's first stable release today, plus linting and tooling improvements to make adoption easier.
+
+
+
+
+
+Today, we're announcing our plans to create the React Foundation and a new technical governance structure ...
-
+
-We are releasing the compiler's first Release Candidate (RC) today.
+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/errors/index.md b/src/content/errors/index.md
index 25746d25d..d4fc3927a 100644
--- a/src/content/errors/index.md
+++ b/src/content/errors/index.md
@@ -7,4 +7,4 @@ In the minified production build of React, we avoid sending down full error mess
We highly recommend using the development build locally when debugging your app since it tracks additional debug info and provides helpful warnings about potential problems in your apps, but if you encounter an exception while using the production build, the error message will include just a link to the docs for the error.
-For an example, see: [https://react.dev/errors/149](/errors/421).
+For an example, see: [https://react.dev/errors/149](/errors/149).
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..af01e046e 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.
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
بسیاری از فریمورکهای مبتنی بر ریاکت فولاستک هستند و به اپلیکیشن ریاکت شما اجازه میدهند از قابلیتهای سرور استفاده کند. با این حال، حتی اگر نتوانید یا نخواهید جاوااسکریپت را روی سرور اجرا کنید، میتوانید از همان رویکرد استفاده کنید. در این حالت، خروجی 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..394b7f87a 100644
--- a/src/content/learn/react-compiler/installation.md
+++ b/src/content/learn/react-compiler/installation.md
@@ -18,28 +18,43 @@ This guide will help you install and configure React Compiler in your React appl
React Compiler is designed to work best with React 19, but it also supports React 17 and 18. Learn more about [React version compatibility](/reference/react-compiler/target).
+<<<<<<< HEAD
React Compiler is currently in RC. Install it using the `@rc` tag to get the latest release candidate version.
+=======
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
## Installation {/*installation*/}
Install React Compiler as a `devDependency`:
+<<<<<<< HEAD
npm install -D babel-plugin-react-compiler@rc
+=======
+npm install -D babel-plugin-react-compiler@latest
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
Or with Yarn:
+<<<<<<< HEAD
yarn add -D babel-plugin-react-compiler@rc
+=======
+yarn add -D babel-plugin-react-compiler@latest
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
Or with pnpm:
+<<<<<<< HEAD
pnpm install -D babel-plugin-react-compiler@rc
+=======
+pnpm install -D babel-plugin-react-compiler@latest
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
## Basic Setup {/*basic-setup*/}
@@ -173,10 +188,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@latest
+
+
+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.
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
The ESLint rule will:
- Identify violations of the [Rules of React](/reference/rules)
@@ -246,4 +268,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
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
diff --git a/src/content/learn/react-compiler/introduction.md b/src/content/learn/react-compiler/introduction.md
index 96fa8802a..065a18280 100644
--- a/src/content/learn/react-compiler/introduction.md
+++ b/src/content/learn/react-compiler/introduction.md
@@ -16,10 +16,13 @@ React Compiler is a new build-time tool that automatically optimizes your React
+<<<<<<< HEAD
React Compiler is currently in Release Candidate (RC). We now recommend everyone to try the compiler and provide feedback. The latest RC release can be found with the `@rc` tag.
+=======
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
## What does React Compiler do? {/*what-does-react-compiler-do*/}
React Compiler automatically optimizes your React application at build time. React is often fast enough without optimization, but sometimes you need to manually memoize components and values to keep your app responsive. This manual memoization is tedious, easy to get wrong, and adds extra code to maintain. React Compiler does this optimization automatically for you, freeing you from this mental burden so you can focus on building features.
@@ -28,7 +31,11 @@ React Compiler automatically optimizes your React application at build time. Rea
Without the compiler, you need to manually memoize components and values to optimize re-renders:
+<<<<<<< HEAD
```js {expectedErrors: {'react-compiler': [4]}}
+=======
+```js
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
import { useMemo, useCallback, memo } from 'react';
const ExpensiveComponent = memo(function ExpensiveComponent({ data, onClick }) {
@@ -157,7 +164,11 @@ We encourage everyone to start using React Compiler. While the compiler is still
### Is it safe to use? {/*is-it-safe-to-use*/}
+<<<<<<< HEAD
React Compiler is now in RC and has been tested extensively in production. While it has been used in production at companies like Meta, rolling out the compiler to production for your app will depend on the health of your codebase and how well you've followed the [Rules of React](/reference/rules).
+=======
+React Compiler is now stable and has been tested extensively in production. While it has been used in production at companies like Meta, rolling out the compiler to production for your app will depend on the health of your codebase and how well you've followed the [Rules of React](/reference/rules).
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
## What build tools are supported? {/*what-build-tools-are-supported*/}
@@ -169,9 +180,19 @@ Next.js users can enable the swc-invoked React Compiler by using [v15.3.1](https
## What should I do about useMemo, useCallback, and React.memo? {/*what-should-i-do-about-usememo-usecallback-and-reactmemo*/}
+<<<<<<< HEAD
React Compiler adds automatic memoization more precisely and granularly than is possible with [`useMemo`](/reference/react/useMemo), [`useCallback`](/reference/react/useCallback), and [`React.memo`](/reference/react/memo). If you choose to keep manual memoization, React Compiler will analyze them and determine if your manual memoization matches its automatically inferred memoization. If there isn't a match, the compiler will choose to bail out of optimizing that component.
This is done out of caution as a common anti-pattern with manual memoization is using it for correctness. This means your app depends on specific values being memoized to work properly. For example, in order to prevent an infinite loop, you may have memoized some values to stop a `useEffect` call from firing. This breaks the Rules of React, but since it can potentially be dangerous for the compiler to automatically remove manual memoization, the compiler will just bail out instead. You should manually remove your handwritten memoization and verify that your app still works as expected.
+=======
+By default, React Compiler will memoize your code based on its analysis and heuristics. In most cases, this memoization will be as precise, or moreso, than what you may have written.
+
+However, in some cases developers may need more control over memoization. The `useMemo` and `useCallback` hooks can continue to be used with React Compiler as an escape hatch to provide control over which values are memoized. A common use-case for this is if a memoized value is used as an effect dependency, in order to ensure that an effect does not fire repeatedly even when its dependencies do not meaningfully change.
+
+For new code, we recommend relying on the compiler for memoization and using `useMemo`/`useCallback` where needed to achieve precise control.
+
+For existing code, we recommend either leaving existing memoization in place (removing it can change compilation output) or carefully testing before removing the memoization.
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
## Try React Compiler {/*try-react-compiler*/}
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..7d5ff634f 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.
```
+=======
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
```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..dc2912da2
--- /dev/null
+++ b/src/content/reference/dev-tools/react-performance-tracks.md
@@ -0,0 +1,159 @@
+---
+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**: Only Scheduler tracks are enabled by default. The Components track only lists Components that are in subtrees wrapped with [``](/reference/react/Profiler). If you have [React Developer Tools extension](/learn/react-developer-tools) enabled, all Components are included in the Components track even if they're not wrapped in ``. Server tracks are not available 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.
+
+
+
+### Using profiling builds {/*using-profiling-builds*/}
+
+In addition to production and development builds, React also includes a special profiling build.
+To use profiling builds, you have to use `react-dom/profiling` instead of `react-dom/client`.
+We recommend that you alias `react-dom/client` to `react-dom/profiling` at build time via bundler aliases instead of manually updating each `react-dom/client` import.
+Your framework might have built-in support for enabling React's profiling build.
+
+---
+
+## 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..54b159a30 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
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
---
@@ -16,12 +20,24 @@ 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 in `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
+* [`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
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
* [`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 +45,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
+=======
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
* [`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/exhaustive-deps.md b/src/content/reference/eslint-plugin-react-hooks/lints/exhaustive-deps.md
index cd26483a1..88ba3cabd 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:
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
```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.
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
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..8084bb10e 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.
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
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..bf8740642 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
@@ -71,7 +71,11 @@ function Component({selectedId, items}) {
Examples of correct code for this rule:
+<<<<<<< HEAD
```js {expectedErrors: {'react-compiler': [8]}}
+=======
+```js
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
// ✅ setState in an effect is fine if the value comes from a ref
function Tooltip() {
const ref = useRef(null);
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..2feee4eb0 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
@@ -4,20 +4,32 @@ title: set-state-in-render
+<<<<<<< HEAD
Validates against setting state during render, which can trigger additional renders and potential infinite render loops.
+=======
+Validates against unconditionally setting state during render, which can trigger additional renders and potential infinite render loops.
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
## Rule Details {/*rule-details*/}
+<<<<<<< HEAD
Calling `setState` during render triggers another render before the current one finishes. This creates an infinite loop that crashes your app.
+=======
+Calling `setState` during render unconditionally triggers another render before the current one finishes. This creates an infinite loop that crashes your app.
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
## Common Violations {/*common-violations*/}
### Invalid {/*invalid*/}
```js {expectedErrors: {'react-compiler': [4]}}
+<<<<<<< HEAD
// ❌ setState directly in render
+=======
+// ❌ Unconditional setState directly in render
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
function Component({value}) {
const [count, setCount] = useState(0);
setCount(value); // Infinite loop!
@@ -50,6 +62,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);
+ }
+ // ...
+}
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
```
## Troubleshooting {/*troubleshooting*/}
@@ -93,3 +121,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.
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
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..6b4babae7 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
@@ -29,10 +29,17 @@ function Parent() {
// ❌ Dynamic component creation
function Parent({type}) {
+<<<<<<< HEAD
const Component = type === 'button'
? () =>
: () =>
;
function Parent({type}) {
+<<<<<<< HEAD
const Component = type === 'button'
? ButtonComponent // Reference existing component
: TextComponent;
+=======
+ const Component = type === 'button'
+ ? ButtonComponent // Reference existing component
+ : TextComponent;
+
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
return ;
}
```
@@ -65,7 +79,11 @@ You might define components inside to access local state:
// ❌ Wrong: Inner component to access parent state
function Parent() {
const [theme, setTheme] = useState('light');
+<<<<<<< HEAD
+=======
+
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
function ThemedButton() { // Recreated every render!
return (
);
}
+<<<<<<< HEAD
+=======
+
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
return ;
}
```
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..ac24a4f82 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
@@ -4,7 +4,11 @@ title: use-memo
+<<<<<<< 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.
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
diff --git a/src/content/reference/react-compiler/compiling-libraries.md b/src/content/reference/react-compiler/compiling-libraries.md
index f09ffcb72..c474c2319 100644
--- a/src/content/reference/react-compiler/compiling-libraries.md
+++ b/src/content/reference/react-compiler/compiling-libraries.md
@@ -21,7 +21,11 @@ As a library author, you can compile your library code before publishing to npm.
Add React Compiler to your library's build process:
+<<<<<<< HEAD
npm install -D babel-plugin-react-compiler@rc
+=======
+npm install -D babel-plugin-react-compiler@latest
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
Configure your build tool to compile your library. For example, with Babel:
@@ -45,13 +49,21 @@ If your library supports React versions below 19, you'll need additional configu
We recommend installing react-compiler-runtime as a direct dependency:
+<<<<<<< HEAD
npm install react-compiler-runtime@rc
+=======
+npm install react-compiler-runtime@latest
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
```json
{
"dependencies": {
+<<<<<<< HEAD
"react-compiler-runtime": "^19.1.0-rc.2"
+=======
+ "react-compiler-runtime": "^1.0.0"
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
},
"peerDependencies": {
"react": "^17.0.0 || ^18.0.0 || ^19.0.0"
diff --git a/src/content/reference/react-compiler/configuration.md b/src/content/reference/react-compiler/configuration.md
index f38f1afc0..8db029145 100644
--- a/src/content/reference/react-compiler/configuration.md
+++ b/src/content/reference/react-compiler/configuration.md
@@ -130,7 +130,11 @@ module.exports = {
Older React versions need the runtime package and target configuration:
```bash
+<<<<<<< HEAD
npm install react-compiler-runtime@rc
+=======
+npm install react-compiler-runtime@latest
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
```
```js
diff --git a/src/content/reference/react-compiler/target.md b/src/content/reference/react-compiler/target.md
index 381748513..aad4d92b7 100644
--- a/src/content/reference/react-compiler/target.md
+++ b/src/content/reference/react-compiler/target.md
@@ -45,7 +45,11 @@ Configures the React version compatibility for the compiled output.
- Always use string values, not numbers (e.g., `'17'` not `17`)
- Don't include patch versions (e.g., use `'18'` not `'18.2.0'`)
- React 19 includes built-in compiler runtime APIs
+<<<<<<< HEAD
- React 17 and 18 require installing `react-compiler-runtime@rc`
+=======
+- React 17 and 18 require installing `react-compiler-runtime@latest`
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
---
@@ -75,7 +79,11 @@ For React 17 and React 18 projects, you need two steps:
1. Install the runtime package:
```bash
+<<<<<<< HEAD
npm install react-compiler-runtime@rc
+=======
+npm install react-compiler-runtime@latest
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
```
2. Configure the target:
@@ -114,7 +122,11 @@ If you see errors like "Cannot find module 'react/compiler-runtime'":
2. If using React 17 or 18, install the runtime:
```bash
+<<<<<<< HEAD
npm install react-compiler-runtime@rc
+=======
+ npm install react-compiler-runtime@latest
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
```
3. Ensure your target matches your React version:
@@ -130,7 +142,11 @@ Ensure the runtime package is:
1. Installed in your project (not globally)
2. Listed in your `package.json` dependencies
+<<<<<<< HEAD
3. The correct version (`@rc` tag)
+=======
+3. The correct version (`@latest` tag)
+>>>>>>> 0d05d9b6ef0f115ec0b96a2726ab0699a9ebafe1
4. Not in `devDependencies` (it's needed at runtime)
### Checking compiled output {/*checking-output*/}
diff --git a/src/content/reference/react-dom/components/form.md b/src/content/reference/react-dom/components/form.md
index b17b1a40b..1043b13a0 100644
--- a/src/content/reference/react-dom/components/form.md
+++ b/src/content/reference/react-dom/components/form.md
@@ -278,7 +278,7 @@ export default function Search() {
Displaying a form submission error message before the JavaScript bundle loads for progressive enhancement requires that:
-1. `