-
Notifications
You must be signed in to change notification settings - Fork 17
Sync with react.dev @ a3e9466d #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
3c805e7
fix(reference): missing parameter in hydrateRoot (#7724)
Kafuu-Chinocya 84261aa
Update versions to mention the latest version: 19.1 (#7739)
val1984 947681e
docs: fix a typo in the docs (#7736)
Clatron 4bea66b
Change the word 'Function' to 'Component' (#7741)
kapantzak 4c54ac9
Fix missing Sunsetting CRA entry in sidebar (#7755)
poteto 3a88efd
Compiler blog post (#7756)
poteto c1e5681
Compiler blog post edits (#7758)
poteto 663df77
React compiler doc updates (#7759)
poteto 740016e
More compiler blog post tweaks (#7760)
poteto 39b9c56
Fix ESLint plugin version. (#7768)
cpojer 5890bd6
Update react-compiler-rc.md (#7769)
poteto dd129e4
fix a typo in name in the blog post (#7762)
witch-factory 55ddaa4
Add React Summit US 2025 and React Advanced London 2025 to conference…
Hlebread 358d2be
[blog + docs] React Labs: View Transitions, Activity, and more (#7772)
rickhanlonii 09c9593
Update Next.js deployment notes (#7771)
eduardoboucas 159df67
Add React Norway 2025 conference to community page (#7766)
danisal f94ab10
Fix typos in blog post
sophiebits 594ff45
Refine wording for Next.js + Compiler + SWC (#7779)
eps1lon d05547b
fix: server-components link in few pages (#7780)
ad1992 ecf7596
docs: rename unstableViewTransition to unstable_ViewTransition (#7778)
nick-private 92dfd8c
fixed typo (#7785)
MrD9877 022e047
Remove extra copy of labs post (#7787)
jackpope 4314b49
Improve grammar in component descriptions (#7788)
Maddily d6c4c0f
Fix useOptimistic example (#7792)
rickhanlonii a3e9466
fix action pattern in useTransition / useOptimistic (#7796)
rickhanlonii 66c474c
Merge branch 'main' of https://github.com/reactjs/react.dev into sync…
react-translations-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
/// <reference types="next/navigation-types/compat/navigation" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. | ||
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
*/ | ||
|
||
import {memo} from 'react'; | ||
|
||
export const IconExperimental = memo< | ||
JSX.IntrinsicElements['svg'] & {title?: string; size?: 's' | 'md'} | ||
>(function IconCanary( | ||
{className, title, size} = { | ||
className: undefined, | ||
title: undefined, | ||
size: 'md', | ||
} | ||
) { | ||
return ( | ||
<svg | ||
className={className} | ||
width={size === 's' ? '12px' : '20px'} | ||
height={size === 's' ? '12px' : '20px'} | ||
viewBox="0 0 20 20" | ||
version="1.1" | ||
xmlns="http://www.w3.org/2000/svg"> | ||
{title && <title>{title}</title>} | ||
<g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd"> | ||
<g | ||
id="noun-labs-1201738-(2)" | ||
transform="translate(2, 0)" | ||
fill="currentColor" | ||
fillRule="nonzero"> | ||
<path | ||
d="M10.2865804,5.55665262 L10.2865804,2.22331605 L10.8591544,2.22331605 C11.0103911,2.22244799 11.1551447,2.16342155 11.2617505,2.05914367 C11.3684534,1.95486857 11.4282767,1.81370176 11.4282767,1.66667106 L11.4282767,0.556642208 C11.4282767,0.40907262 11.3678934,0.26747526 11.2605218,0.16308627 C11.1531503,0.0587028348 11.0074938,0 10.8556998,0 L5.14338868,0 C4.9915947,0 4.84594391,0.0587028348 4.73856664,0.16308627 C4.63119507,0.267469704 4.57081178,0.40907262 4.57081178,0.556642208 L4.57081178,1.66667106 C4.57081178,1.81434899 4.63119507,1.95594912 4.73856664,2.06033811 C4.8459382,2.16472155 4.9915947,2.22331605 5.14338868,2.22331605 L5.71596273,2.22331605 L5.71596273,5.55665262 C5.71596273,8.38665538 2.97295619,9.88999017 0.651686904,15.5566623 C-0.0957823782,17.360053 -2.00560068,20 7.99951567,20 C18.004632,20 16.0948137,17.3600252 15.3507732,15.5566623 C13.0124432,9.88999017 10.2865804,8.38665538 10.2865804,5.55665262 Z M9.89570197,10.709991 C10.0921412,10.709991 10.2805515,10.7858383 10.4193876,10.9209301 C10.5583466,11.0559135 10.6363652,11.2390693 10.6363652,11.4300417 C10.6363652,11.6210141 10.5583466,11.8040698 10.4193876,11.9391533 C10.2805401,12.0741367 10.0921412,12.1499813 9.89570197,12.1499813 C9.6992627,12.1499813 9.51096673,12.074134 9.37201631,11.9391533 C9.23316875,11.8040615 9.15515307,11.6210141 9.15515307,11.4300417 C9.15515307,11.2390693 9.2331716,11.0559024 9.37201631,10.9209301 C9.57264221,10.7258996 9.61239426,10.709991 9.89570197,10.709991 Z M8.98919546,9.04212824 C9.09790709,9.14792278 9.15884755,9.29158681 9.1585213,9.44110085 C9.15829001,9.59073155 9.09678989,9.73407335 8.98763252,9.83954568 C8.87847514,9.945018 8.73069852,10.0039347 8.57678157,10.0033977 C8.42286747,10.0027392 8.27565088,9.94273467 8.16727355,9.83639845 C8.05900765,9.73006224 7.99873866,9.58628988 7.99963013,9.43664806 C8.00052304,9.28788403 8.0620221,9.14542556 8.17051087,9.04048101 C8.27911107,8.93555591 8.42599335,8.87663641 8.57913312,8.87663641 C8.73291864,8.87665585 8.88047525,8.93622535 8.98919546,9.04212824 Z M7.99965585,17.9999981 C4.91377349,17.9999981 3.29882839,17.7332867 2.51364277,17.4999976 C2.37780966,17.4476975 2.26954376,17.3439641 2.21396931,17.2125528 C2.15838628,17.0811499 2.16006066,16.9334692 2.21876871,16.8033858 C2.6144474,15.5921346 3.14916224,14.4280501 3.81316983,13.3333824 C5.980145,9.82337899 8.22941036,13.8867718 10.0980836,13.8867718 C11.9666996,13.8867718 11.4695868,12.1534924 12.1827971,13.3333824 C12.8511505,14.4269112 13.3916656,15.5896902 13.794259,16.8000524 C13.8533022,16.9322137 13.8537479,17.0822749 13.7952635,17.2147751 C13.7368889,17.3472613 13.6248314,17.4504531 13.4856467,17.5000531 C12.6833967,17.7332867 11.0855382,17.9999981 7.99965585,17.9999981 Z" | ||
id="Shape"></path> | ||
</g> | ||
</g> | ||
</svg> | ||
); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
--- | ||
title: "React Compiler RC" | ||
author: Lauren Tan and Mofei Zhang | ||
date: 2025/04/21 | ||
description: We are releasing the compiler's first Release Candidate (RC) today. | ||
|
||
--- | ||
|
||
April 21, 2025 by [Lauren Tan](https://x.com/potetotes) and [Mofei Zhang](https://x.com/zmofei). | ||
|
||
--- | ||
|
||
<Intro> | ||
|
||
The React team is excited to share new updates: | ||
|
||
</Intro> | ||
|
||
1. We're publishing React Compiler RC today, in preparation of the compiler's stable release. | ||
2. We're merging `eslint-plugin-react-compiler` into `eslint-plugin-react-hooks`. | ||
3. We've added support for swc and are working with oxc to support Babel-free builds. | ||
|
||
--- | ||
|
||
[React Compiler](https://react.dev/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](https://react.dev/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 working towards a stable release. | ||
|
||
We are releasing the compiler's first Release Candidate (RC) today. The RC is intended to be a stable and near-final version of the compiler, and safe to try out in production. | ||
|
||
## Use React Compiler RC today {/*use-react-compiler-rc-today*/} | ||
To install the RC: | ||
|
||
npm | ||
<TerminalBlock> | ||
{`npm install --save-dev --save-exact babel-plugin-react-compiler@rc`} | ||
</TerminalBlock> | ||
|
||
pnpm | ||
<TerminalBlock> | ||
{`pnpm add --save-dev --save-exact babel-plugin-react-compiler@rc`} | ||
</TerminalBlock> | ||
|
||
yarn | ||
<TerminalBlock> | ||
{`yarn add --dev --exact babel-plugin-react-compiler@rc`} | ||
</TerminalBlock> | ||
|
||
As part of the RC, we've been making React Compiler easier to add to your projects and added optimizations to how the compiler generates memoization. React Complier now supports optional chains and array indices as dependencies. We're exploring how to infer even more dependencies like equality checks and string interpolation. These improvements ultimately result in fewer re-renders and more responsive UIs. | ||
|
||
We have also heard from the community that the ref-in-render validation sometimes has false positives. Since as a general philosophy we want you to be able to fully trust in the compiler's error messages and hints, we are turning it off by default for now. We will keep working to improve this validation, and we will re-enable it in a follow up release. | ||
|
||
You can find more details on using the Compiler in [our docs](https://react.dev/learn/react-compiler). | ||
|
||
## Feedback {/*feedback*/} | ||
During the RC period, we encourage all React users to try the compiler and provide feedback in the React repo. Please [open an issue](https://github.com/facebook/react/issues) if you encounter any bugs or unexpected behavior. If you have a general question or suggestion, please post them in the [React Compiler Working Group](https://github.com/reactwg/react-compiler/discussions). | ||
|
||
## 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](https://react.dev/learn/react-compiler#using-react-compiler-with-react-17-or-18). | ||
|
||
## Migrating from eslint-plugin-react-compiler to eslint-plugin-react-hooks {/*migrating-from-eslint-plugin-react-compiler-to-eslint-plugin-react-hooks*/} | ||
If you have already installed eslint-plugin-react-compiler, you can now remove it and use `[email protected]`. Many thanks to [@michaelfaith](https://bsky.app/profile/michael.faith) for contributing to this improvement! | ||
|
||
To install: | ||
|
||
npm | ||
<TerminalBlock> | ||
{`npm install --save-dev [email protected]`} | ||
</TerminalBlock> | ||
|
||
pnpm | ||
<TerminalBlock> | ||
{`pnpm add --save-dev [email protected]`} | ||
</TerminalBlock> | ||
|
||
yarn | ||
<TerminalBlock> | ||
{`yarn add --dev [email protected]`} | ||
</TerminalBlock> | ||
|
||
```js | ||
// eslint.config.js | ||
import * as reactHooks from 'eslint-plugin-react-hooks'; | ||
|
||
export default [ | ||
// Flat Config (eslint 9+) | ||
reactHooks.configs.recommended, | ||
|
||
// Legacy Config | ||
reactHooks.configs['recommended-latest'] | ||
]; | ||
``` | ||
|
||
To enable the React Compiler rule, add `'react-hooks/react-compiler': 'error'` to your ESLint configuration. | ||
|
||
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. | ||
|
||
## 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](https://react.dev/learn/react-compiler#usage-with-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](https://react.dev/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](https://react.dev/learn/synchronizing-with-effects), your codebase may have useEffects 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 `19.1.0`) rather than a SemVer range (eg `^19.1.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. | ||
|
||
## Roadmap to Stable {/*roadmap-to-stable*/} | ||
*This is not a final roadmap, and is subject to change.* | ||
|
||
After a period of final feedback from the community on the RC, we plan on a Stable Release for the compiler. | ||
|
||
* ✅ Experimental: Released at React Conf 2024, primarily for feedback from application developers. | ||
* ✅ Public Beta: Available today, for feedback from library authors. | ||
* ✅ Release Candidate (RC): React Compiler works for the majority of rule-following apps and libraries without issue. | ||
* General Availability: After final feedback period from the community. | ||
|
||
Post-Stable, we plan to add more compiler optimizations and improvements. This includes both continual improvements to automatic memoization, and new optimizations altogether, with minimal to no change of product code. Each upgrade will continue to improve performance and add better handling of diverse JavaScript and React patterns. | ||
|
||
--- | ||
|
||
Thanks to [Joe Savona](https://x.com/en_JS), [Jason Bonta](https://x.com/someextent), [Jimmy Lai](https://x.com/feedthejim), and [Kang Dongyoon](https://x.com/kdy1dev) (@kdy1dev) for reviewing and editing this post. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.