Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d177edf

Browse files
Merge branch 'main' of https://github.com/reactjs/react.dev into sync-a5181c29
2 parents bd48eb8 + a5181c2 commit d177edf

File tree

8 files changed

+166
-23
lines changed

8 files changed

+166
-23
lines changed

next-env.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
/// <reference types="next/navigation-types/compat/navigation" />
43

54
// NOTE: This file should not be edited
6-
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
5+
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

src/components/Icon/IconExperimental.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {memo} from 'react';
66

77
export const IconExperimental = memo<
88
JSX.IntrinsicElements['svg'] & {title?: string; size?: 's' | 'md'}
9-
>(function IconCanary(
9+
>(function IconExperimental(
1010
{className, title, size} = {
1111
className: undefined,
1212
title: undefined,

src/components/MDX/MDXComponents.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {finishedTranslations} from 'utils/finishedTranslations';
3737

3838
import ErrorDecoder from './ErrorDecoder';
3939
import {IconCanary} from '../Icon/IconCanary';
40+
import {IconExperimental} from 'components/Icon/IconExperimental';
4041

4142
function CodeStep({children, step}: {children: any; step: number}) {
4243
return (
@@ -130,7 +131,7 @@ const ExperimentalBadge = ({title}: {title: string}) => (
130131
className={
131132
'text-base font-display px-1 py-0.5 font-bold bg-gray-10 dark:bg-gray-60 text-gray-60 dark:text-gray-10 rounded'
132133
}>
133-
<IconCanary
134+
<IconExperimental
134135
size="s"
135136
className={'inline me-1 mb-0.5 text-sm text-gray-60 dark:text-gray-10'}
136137
/>

src/content/blog/2025/04/23/react-labs-view-transitions-activity-and-more.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11465,6 +11465,14 @@ _For more background on how we built View Transitions, see: [#31975](https://git
1146511465

1146611466
## Activity {/*activity*/}
1146711467

11468+
<Note>
11469+
11470+
**`<Activity />` is now available in React’s Canary channel.**
11471+
11472+
[Learn more about React’s release channels here.](/community/versioning-policy#all-release-channels)
11473+
11474+
</Note>
11475+
1146811476
In [past](/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022#offscreen) [updates](/blog/2024/02/15/react-labs-what-we-have-been-working-on-february-2024#offscreen-renamed-to-activity), we shared that we were researching an API to allow components to be visually hidden and deprioritized, preserving UI state with reduced performance costs relative to unmounting or hiding with CSS.
1146911477

1147011478
We're now ready to share the API and how it works, so you can start testing it in experimental React versions.

src/content/community/videos.md

Lines changed: 76 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,75 @@ Videos dedicated to the discussion of React and the React ecosystem.
88

99
</Intro>
1010

11+
## React Conf 2024 {/*react-conf-2024*/}
12+
13+
At React Conf 2024, Meta CTO [Andrew "Boz" Bosworth](https://www.threads.net/@boztank) shared a welcome message to kick off the conference:
14+
15+
<YouTubeIframe src="https://www.youtube.com/embed/T8TZQ6k4SLE?t=975s" title="Boz and Seth Intro" />
16+
17+
### React 19 Keynote {/*react-19-keynote*/}
18+
19+
In the Day 1 keynote, we shared vision for React starting with React 19 and the React Compiler. Watch the full keynote from [Joe Savona](https://twitter.com/en_JS), [Lauren Tan](https://twitter.com/potetotes), [Andrew Clark](https://twitter.com/acdlite), [Josh Story](https://twitter.com/joshcstory), [Sathya Gunasekaran](https://twitter.com/_gsathya), and [Mofei Zhang](https://twitter.com/zmofei):
20+
21+
22+
<YouTubeIframe src="https://www.youtube.com/embed/lyEKhv8-3n0" title="YouTube video player" />
23+
24+
### React Unpacked: A Roadmap to React 19 {/*react-unpacked-a-roadmap-to-react-19*/}
25+
26+
React 19 introduced new features including Actions, `use()`, `useOptimistic` and more. For a deep dive on using new features in React 19, see [Sam Selikoff's](https://twitter.com/samselikoff) talk:
27+
28+
<YouTubeIframe src="https://www.youtube.com/embed/R0B2HsSM78s" title="React Unpacked: A Roadmap to React 19" />
29+
30+
### What's New in React 19 {/*whats-new-in-react-19*/}
31+
32+
[Lydia Hallie](https://twitter.com/lydiahallie) gave a visual deep dive of React 19's new features:
33+
34+
<YouTubeIframe src="https://www.youtube.com/embed/AJOGzVygGcY" title="What's New in React 19" />
35+
36+
### React 19 Deep Dive: Coordinating HTML {/*react-19-deep-dive-coordinating-html*/}
37+
38+
[Josh Story](https://twitter.com/joshcstory) provided a deep dive on the document and resource streaming APIs in React 19:
39+
40+
<YouTubeIframe src="https://www.youtube.com/embed/IBBN-s77YSI" title="React 19 Deep Dive: Coordinating HTML" />
41+
42+
### React for Two Computers {/*react-for-two-computers*/}
43+
44+
[Dan Abramov](https://bsky.app/profile/danabra.mov) imagined an alternate history where React started server-first:
45+
46+
<YouTubeIframe src="https://www.youtube.com/embed/ozI4V_29fj4" title="React for Two Computers" />
47+
48+
### Forget About Memo {/*forget-about-memo*/}
49+
50+
[Lauren Tan](https://twitter.com/potetotes) gave a talk on using the React Compiler in practice:
51+
52+
<YouTubeIframe src="https://www.youtube.com/embed/lvhPq5chokM" title="Forget About Memo" />
53+
54+
### React Compiler Deep Dive {/*react-compiler-deep-dive*/}
55+
56+
[Sathya Gunasekaran](https://twitter.com/_gsathya) and [Mofei Zhang](https://twitter.com/zmofei) provided a deep dive on how the React Compiler works:
57+
58+
<YouTubeIframe src="https://www.youtube.com/embed/uA_PVyZP7AI" title="React Compiler Deep Dive" />
59+
60+
### And more... {/*and-more-2024*/}
61+
62+
**We also heard talks from the community on Server Components:**
63+
* [Enhancing Forms with React Server Components](https://www.youtube.com/embed/0ckOUBiuxVY&t=25280s) by [Aurora Walberg Scharff](https://twitter.com/aurorascharff)
64+
* [And Now You Understand React Server Components](https://www.youtube.com/embed/pOo7x8OiAec) by [Kent C. Dodds](https://twitter.com/kentcdodds)
65+
* [Real-time Server Components](https://www.youtube.com/embed/6sMANTHWtLM) by [Sunil Pai](https://twitter.com/threepointone)
66+
67+
**Talks from React frameworks using new features:**
68+
69+
* [Vanilla React](https://www.youtube.com/embed/ZcwA0xt8FlQ) by [Ryan Florence](https://twitter.com/ryanflorence)
70+
* [React Rhythm & Blues](https://www.youtube.com/embed/rs9X5MjvC4s) by [Lee Robinson](https://twitter.com/leeerob)
71+
* [RedwoodJS, now with React Server Components](https://www.youtube.com/embed/sjyY4MTECUU) by [Amy Dutton](https://twitter.com/selfteachme)
72+
* [Introducing Universal React Server Components in Expo Router](https://www.youtube.com/embed/djhEgxQf3Kw) by [Evan Bacon](https://twitter.com/Baconbrix)
73+
74+
**And Q&As with the React and React Native teams:**
75+
- [React Q&A](https://www.youtube.com/embed/T8TZQ6k4SLE&t=27518s) hosted by [Michael Chan](https://twitter.com/chantastic)
76+
- [React Native Q&A](https://www.youtube.com/embed/0ckOUBiuxVY&t=27935s) hosted by [Jamon Holmgren](https://twitter.com/jamonholmgren)
77+
78+
You can watch all of the talks at React Conf 2024 at [conf2024.react.dev](https://conf2024.react.dev/talks).
79+
1180
## React Conf 2021 {/*react-conf-2021*/}
1281

1382
### React 18 Keynote {/*react-18-keynote*/}
@@ -16,13 +85,13 @@ In the keynote, we shared our vision for the future of React starting with React
1685

1786
Watch the full keynote from [Andrew Clark](https://twitter.com/acdlite), [Juan Tejada](https://twitter.com/_jstejada), [Lauren Tan](https://twitter.com/potetotes), and [Rick Hanlon](https://twitter.com/rickhanlonii) here:
1887

19-
<YouTubeIframe src="https://www.youtube.com/embed/FZ0cG47msEk" title="YouTube video player" />
88+
<YouTubeIframe src="https://www.youtube.com/embed/FZ0cG47msEk" title="React 18 Keynote" />
2089

2190
### React 18 for Application Developers {/*react-18-for-application-developers*/}
2291

2392
For a demo of upgrading to React 18, see [Shruti Kapoor](https://twitter.com/shrutikapoor08)’s talk here:
2493

25-
<YouTubeIframe src="https://www.youtube.com/embed/ytudH8je5ko" title="YouTube video player" />
94+
<YouTubeIframe src="https://www.youtube.com/embed/ytudH8je5ko" title="React 18 for Application Developers" />
2695

2796
### Streaming Server Rendering with Suspense {/*streaming-server-rendering-with-suspense*/}
2897

@@ -32,35 +101,35 @@ Streaming server rendering lets you generate HTML from React components on the s
32101

33102
For a deep dive, see [Shaundai Person](https://twitter.com/shaundai)’s talk here:
34103

35-
<YouTubeIframe src="https://www.youtube.com/embed/pj5N-Khihgc" title="YouTube video player" />
104+
<YouTubeIframe src="https://www.youtube.com/embed/pj5N-Khihgc" title="Streaming Server Rendering with Suspense" />
36105

37106
### The first React working group {/*the-first-react-working-group*/}
38107

39108
For React 18, we created our first Working Group to collaborate with a panel of experts, developers, library maintainers, and educators. Together we worked to create our gradual adoption strategy and refine new APIs such as `useId`, `useSyncExternalStore`, and `useInsertionEffect`.
40109

41110
For an overview of this work, see [Aakansha' Doshi](https://twitter.com/aakansha1216)'s talk:
42111

43-
<YouTubeIframe src="https://www.youtube.com/embed/qn7gRClrC9U" title="YouTube video player" />
112+
<YouTubeIframe src="https://www.youtube.com/embed/qn7gRClrC9U" title="The first React working group" />
44113

45114
### React Developer Tooling {/*react-developer-tooling*/}
46115

47116
To support the new features in this release, we also announced the newly formed React DevTools team and a new Timeline Profiler to help developers debug their React apps.
48117

49118
For more information and a demo of new DevTools features, see [Brian Vaughn](https://twitter.com/brian_d_vaughn)’s talk:
50119

51-
<YouTubeIframe src="https://www.youtube.com/embed/oxDfrke8rZg" title="YouTube video player" />
120+
<YouTubeIframe src="https://www.youtube.com/embed/oxDfrke8rZg" title="React Developer Tooling" />
52121

53122
### React without memo {/*react-without-memo*/}
54123

55124
Looking further into the future, [Xuan Huang (黄玄)](https://twitter.com/Huxpro) shared an update from our React Labs research into an auto-memoizing compiler. Check out this talk for more information and a demo of the compiler prototype:
56125

57-
<YouTubeIframe src="https://www.youtube.com/embed/lGEMwh32soc" title="YouTube video player" />
126+
<YouTubeIframe src="https://www.youtube.com/embed/lGEMwh32soc" title="React without memo" />
58127

59128
### React docs keynote {/*react-docs-keynote*/}
60129

61130
[Rachel Nabors](https://twitter.com/rachelnabors) kicked off a section of talks about learning and designing with React with a keynote about our investment in React's new docs ([now shipped as react.dev](/blog/2023/03/16/introducing-react-dev)):
62131

63-
<YouTubeIframe src="https://www.youtube.com/embed/mneDaMYOKP8" title="YouTube video player" />
132+
<YouTubeIframe src="https://www.youtube.com/embed/mneDaMYOKP8" title="React docs keynote" />
64133

65134
### And more... {/*and-more*/}
66135

src/content/reference/react-dom/flushSync.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,75 @@ export default function PrintApp() {
131131
বেশির ভাগ সময়, `flushSync` এর ব্যবহার এড়িয়ে চলা যায়। `flushSync` কে ব্যবহার করুন last resort হিসেবে।
132132

133133
</Pitfall>
134+
135+
---
136+
137+
## Troubleshooting {/*troubleshooting*/}
138+
139+
### I'm getting an error: "flushSync was called from inside a lifecycle method" {/*im-getting-an-error-flushsync-was-called-from-inside-a-lifecycle-method*/}
140+
141+
142+
React cannot `flushSync` in the middle of a render. If you do, it will noop and warn:
143+
144+
<ConsoleBlock level="error">
145+
146+
Warning: flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.
147+
148+
</ConsoleBlock>
149+
150+
This includes calling `flushSync` inside:
151+
152+
- rendering a component.
153+
- `useLayoutEffect` or `useEffect` hooks.
154+
- Class component lifecycle methods.
155+
156+
For example, calling `flushSync` in an Effect will noop and warn:
157+
158+
```js
159+
import { useEffect } from 'react';
160+
import { flushSync } from 'react-dom';
161+
162+
function MyComponent() {
163+
useEffect(() => {
164+
// 🚩 Wrong: calling flushSync inside an effect
165+
flushSync(() => {
166+
setSomething(newValue);
167+
});
168+
}, []);
169+
170+
return <div>{/* ... */}</div>;
171+
}
172+
```
173+
174+
To fix this, you usually want to move the `flushSync` call to an event:
175+
176+
```js
177+
function handleClick() {
178+
// ✅ Correct: flushSync in event handlers is safe
179+
flushSync(() => {
180+
setSomething(newValue);
181+
});
182+
}
183+
```
184+
185+
186+
If it's difficult to move to an event, you can defer `flushSync` in a microtask:
187+
188+
```js {3,7}
189+
useEffect(() => {
190+
// ✅ Correct: defer flushSync to a microtask
191+
queueMicrotask(() => {
192+
flushSync(() => {
193+
setSomething(newValue);
194+
});
195+
});
196+
}, []);
197+
```
198+
199+
This will allow the current render to finish and schedule another syncronous render to flush the updates.
200+
201+
<Pitfall>
202+
203+
`flushSync` can significantly hurt performance, but this particular pattern is even worse for performance. Exhaust all other options before calling `flushSync` in a microtask as an escape hatch.
204+
205+
</Pitfall>

src/content/reference/react/Activity.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
---
22
title: <Activity>
3-
version: experimental
3+
version: canary
44
---
55

6-
<Experimental>
6+
<Canary>
77

8-
**This API is experimental and is not available in a stable version of React yet.**
8+
**The `<Activity />` API is currently only available in React’s Canary and Experimental channels.**
99

10-
You can try it by upgrading React packages to the most recent experimental version:
10+
[Learn more about React’s release channels here.](/community/versioning-policy#all-release-channels)
1111

12-
- `react@experimental`
13-
- `react-dom@experimental`
14-
- `eslint-plugin-react-hooks@experimental`
15-
16-
Experimental versions of React may contain bugs. Don't use them in production.
17-
18-
</Experimental>
12+
</Canary>
1913

2014
<Intro>
2115

src/sidebarReference.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
{
108108
"title": "<Activity>",
109109
"path": "/reference/react/Activity",
110-
"version": "experimental"
110+
"version": "canary"
111111
},
112112
{
113113
"title": "<ViewTransition>",

0 commit comments

Comments
 (0)