Skip to content

Sync with react.dev @ 2571aee6 #1204

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 51 commits into from
May 31, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
3c805e7
fix(reference): missing parameter in hydrateRoot (#7724)
Kafuu-Chinocya Apr 15, 2025
84261aa
Update versions to mention the latest version: 19.1 (#7739)
val1984 Apr 15, 2025
947681e
docs: fix a typo in the docs (#7736)
Clatron Apr 15, 2025
4bea66b
Change the word 'Function' to 'Component' (#7741)
kapantzak Apr 16, 2025
4c54ac9
Fix missing Sunsetting CRA entry in sidebar (#7755)
poteto Apr 21, 2025
3a88efd
Compiler blog post (#7756)
poteto Apr 21, 2025
c1e5681
Compiler blog post edits (#7758)
poteto Apr 21, 2025
663df77
React compiler doc updates (#7759)
poteto Apr 21, 2025
740016e
More compiler blog post tweaks (#7760)
poteto Apr 21, 2025
39b9c56
Fix ESLint plugin version. (#7768)
cpojer Apr 23, 2025
5890bd6
Update react-compiler-rc.md (#7769)
poteto Apr 23, 2025
dd129e4
fix a typo in name in the blog post (#7762)
witch-factory Apr 23, 2025
55ddaa4
Add React Summit US 2025 and React Advanced London 2025 to conference…
Hlebread Apr 23, 2025
358d2be
[blog + docs] React Labs: View Transitions, Activity, and more (#7772)
rickhanlonii Apr 23, 2025
09c9593
Update Next.js deployment notes (#7771)
eduardoboucas Apr 23, 2025
159df67
Add React Norway 2025 conference to community page (#7766)
danisal Apr 24, 2025
f94ab10
Fix typos in blog post
sophiebits Apr 24, 2025
594ff45
Refine wording for Next.js + Compiler + SWC (#7779)
eps1lon Apr 25, 2025
d05547b
fix: server-components link in few pages (#7780)
ad1992 Apr 26, 2025
ecf7596
docs: rename unstableViewTransition to unstable_ViewTransition (#7778)
nickwlker Apr 27, 2025
92dfd8c
fixed typo (#7785)
MrD9877 Apr 28, 2025
022e047
Remove extra copy of labs post (#7787)
jackpope Apr 28, 2025
4314b49
Improve grammar in component descriptions (#7788)
Maddily Apr 29, 2025
d6c4c0f
Fix useOptimistic example (#7792)
rickhanlonii Apr 29, 2025
a3e9466
fix action pattern in useTransition / useOptimistic (#7796)
rickhanlonii Apr 30, 2025
73d7073
fix: correct overlay highlighting in code examples (#7669)
mrbadri May 15, 2025
4a7bdc1
fix: the value property of checkbox to the checked property (#7804)
kosh-jp May 16, 2025
ae4a40a
No need for useState here — useCounter handles the state internally (…
gbhardwaj00 May 16, 2025
a73055f
docs: fix misplaced prepositional phrase error (#7799)
mehmetmalli May 16, 2025
e2d9fd7
Fix wrong documentation for effect events (#7800)
gbhardwaj00 May 16, 2025
b92bb59
Remove stray console.log and image (#7814)
rickhanlonii May 16, 2025
b3b2166
fix(template): remove unnecessary import of React in template code (#…
dahoho May 16, 2025
9fb0519
fix(reference): correct singular form of 'Server Functions' to 'Serve…
dahoho May 16, 2025
69ce5d3
Add bold mono font (#7815)
rickhanlonii May 16, 2025
8b2fe2b
Remove TODO comments and convert them to issues (#7743)
BartoszKlonowski May 16, 2025
00587d6
Add example of `useActionState` handling execution order (#7733)
ajits01 May 16, 2025
79e1c48
docs: update vite link (#7784)
bornkiss May 16, 2025
c289cd0
docs: add bsky link (#7781)
bornkiss May 16, 2025
7ab1969
React Montreal Meetings have a new link (#7809)
EricCote May 16, 2025
f275c9d
fix: remove useless content (#6615)
loveloki May 17, 2025
0b68054
fix: wrong verb tense in doc (#7818)
aalhoura May 17, 2025
65d297e
fix: typo in challenge solution (#7816)
aalhoura May 17, 2025
f15830d
Use experiemental in all uEE doc sandboxes (#7820)
rickhanlonii May 20, 2025
2571aee
Author: Josh Story <[email protected]>
gnoff May 21, 2025
6e9b848
merging all conflicts
react-translations-bot May 26, 2025
41cdd2c
docs: update `blog/index.md`
lumirlumir May 31, 2025
d897005
wip: update `editor-setup.md`
lumirlumir May 31, 2025
c3adad9
docs: update `community/index.md`
lumirlumir May 31, 2025
803d5aa
docs: resolve conflicts
lumirlumir May 31, 2025
3565b9b
wip: update `learn/index.md`
lumirlumir May 31, 2025
09a80ea
Merge branch 'main' into sync-2571aee6
lumirlumir May 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Compiler blog post (#7756)
Blog post for Compiler RC
  • Loading branch information
poteto authored Apr 21, 2025
commit 3a88efd82ac6e3e5a2bc31430fbe20c07cfb6ef2
3 changes: 1 addition & 2 deletions next-env.d.ts
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.
124 changes: 124 additions & 0 deletions src/content/blog/2025/04/21/react-compiler-rc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
---
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 simplifying your eslint setup by merging `eslint-plugin-react-compiler` into `eslint-plugin-react-hooks`.
3. We're working with the swc and oxc teams to add plugins to allow for Babel-free build pipelines.

---

[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 use in production for all React users.

## 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).

### 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*/}
To install eslint-plugin-react-hooks:

npm
<TerminalBlock>
{`npm install --save-dev eslint-plugin-react-hooks@^6.0.0`}
</TerminalBlock>

pnpm
<TerminalBlock>
{`pnpm add --save-dev eslint-plugin-react-hooks@^6.0.0`}
</TerminalBlock>

yarn
<TerminalBlock>
{`yarn add --dev eslint-plugin-react-hooks@^6.0.0`}
</TerminalBlock>

`eslint-plugin-react-hooks` 5.2.0 has been ported to TypeScript, which allowed us to improve the type-safety of the plugin. In the 6.0.0 release of the ESLint plugin, the compiler lint rule has now been merged in. If you were previously using `eslint-plugin-react-compiler`, this means you can now use a single ESLint plugin in your codebase. Many thanks to [@michaelfaith](https://bsky.app/profile/michael.faith) for contributing to this improvement!

```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']
];
```

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 and oxc support (experimental) {/*swc-and-oxc-support-experimental*/}
We have also been collaborating with Kang Dongyoong ([@kdy1dev](https://x.com/kdy1dev)) from the [swc](https://swc.rs/) team on adding support for React Compiler as an swc plugin. As part of the RC release, you can integrate the compiler into your [Next.js app with swc](https://nextjs.org/docs/app/api-reference/config/next-config-js/reactCompiler) instead of babel. 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), which should allow more people to use the compiler if they have already migrated off of Babel.

Next.js users can upgrade to [15.3.1](https://github.com/vercel/next.js/releases/tag/v15.3.1) or greater to try this out. If you have already enabled the compiler in your Next.js's config, swc support will be enabled automatically.

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). 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. For example you may have an effect that runs in response to some value changing (breaks the rules of React).

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.0.0`) rather than a SemVer range (eg `^19.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.

## 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.

## 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).

---

Thanks to [Joe Savona](https://x.com/en_JS), [Jason Bonta](https://twitter.com/someextent), [Jimmy Lai](https://x.com/feedthejim), and [Kang Dongyoon](https://x.com/kdy1dev) (@kdy1dev) for reviewing and editing this post.
7 changes: 7 additions & 0 deletions src/content/blog/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ You can also follow the [@react.dev](https://bsky.app/profile/react.dev) account

<div className="sm:-mx-5 flex flex-col gap-5 mt-12">

<BlogCard title="React Compiler RC" date="April 21, 2025" url="/blog/2025/04/21/react-compiler-rc">

We are releasing the compiler's first Release Candidate (RC) today. ...

</BlogCard>


<BlogCard title="Sunsetting Create React App" date="February 14, 2025" url="/blog/2025/02/14/sunsetting-create-react-app">

Today, we’re deprecating Create React App for new apps, and encouraging existing apps to migrate to a framework, or to migrate to a build tool like Vite, Parcel, or RSBuild. We’re also providing docs for when a framework isn’t a good fit for your project, you want to build your own framework, or you just want to learn how React works by building a React app from scratch ...
Expand Down
8 changes: 2 additions & 6 deletions src/content/learn/react-compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ title: React Compiler
This page will give you an introduction to React Compiler and how to try it out successfully.
</Intro>

<Wip>
These docs are still a work in progress. More documentation is available in the [React Compiler Working Group repo](https://github.com/reactwg/react-compiler/discussions), and will be upstreamed into these docs when they are more stable.
</Wip>

<YouWillLearn>

* Getting started with the compiler
Expand All @@ -19,9 +15,9 @@ These docs are still a work in progress. More documentation is available in the
</YouWillLearn>

<Note>
React Compiler is a new compiler currently in Beta, that we've open sourced to get early feedback from the community. 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 a new compiler currently in RC, that we've open sourced to get feedback from the community. We now recommend everyone to use the compiler.

The latest Beta release can be found with the `@beta` tag, and daily experimental releases with `@experimental`.
The latest RC release can be found with the `@rc` tag, and daily experimental releases with `@experimental`.
</Note>

React Compiler is a new compiler that we've open sourced to get early feedback from the community. It is a build-time only tool that automatically optimizes your React app. It works with plain JavaScript, and understands the [Rules of React](/reference/rules), so you don't need to rewrite any code to use it.
Expand Down
7 changes: 7 additions & 0 deletions src/sidebarBlog.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
"path": "/blog",
"skipBreadcrumb": true,
"routes": [
{
"title": "React Compiler RC",
"titleForHomepage": "React Compiler RC",
"icon": "blog",
"date": "April 21, 2025",
"path": "/blog/2025/04/21/react-compiler-rc"
},
{
"title": "Sunsetting Create React App",
"titleForHomepage": "Sunsetting Create React App",
Expand Down