Skip to content

Commit 4f81eda

Browse files
authored
Merge pull request #104 from reactjs/sync-2774ddfa
Sync with react.dev @ 2774ddf
2 parents cf195fd + eed8ace commit 4f81eda

File tree

8 files changed

+89
-60
lines changed

8 files changed

+89
-60
lines changed

next-env.d.ts

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

45
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
6+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*/
4+
5+
import * as React from 'react';
6+
import {IconClose} from '../../Icon/IconClose';
7+
export interface ClearButtonProps {
8+
onClear: () => void;
9+
}
10+
11+
export function ClearButton({onClear}: ClearButtonProps) {
12+
return (
13+
<button
14+
className="text-sm text-primary dark:text-primary-dark inline-flex items-center hover:text-link duration-100 ease-in transition mx-1"
15+
onClick={onClear}
16+
title="Clear all edits and reload sandbox"
17+
type="button">
18+
<IconClose className="inline mx-1 relative" />
19+
<span className="hidden md:block">Clear</span>
20+
</button>
21+
);
22+
}

src/components/MDX/Sandpack/NavigationBar.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import {
1717
useSandpackNavigation,
1818
} from '@codesandbox/sandpack-react/unstyled';
1919
import {OpenInCodeSandboxButton} from './OpenInCodeSandboxButton';
20-
import {ResetButton} from './ResetButton';
20+
import {ReloadButton} from './ReloadButton';
21+
import {ClearButton} from './ClearButton';
2122
import {DownloadButton} from './DownloadButton';
2223
import {IconChevron} from '../../Icon/IconChevron';
2324
import {Listbox} from '@headlessui/react';
@@ -95,21 +96,21 @@ export function NavigationBar({providedFiles}: {providedFiles: Array<string>}) {
9596
// Note: in a real useEvent, onContainerResize would be omitted.
9697
}, [isMultiFile, onContainerResize]);
9798

98-
const handleReset = () => {
99+
const handleClear = () => {
99100
/**
100101
* resetAllFiles must come first, otherwise
101102
* the previous content will appear for a second
102103
* when the iframe loads.
103104
*
104105
* Plus, it should only prompt if there's any file changes
105106
*/
106-
if (
107-
sandpack.editorState === 'dirty' &&
108-
confirm('Reset all your edits too?')
109-
) {
107+
if (sandpack.editorState === 'dirty' && confirm('Clear all your edits?')) {
110108
sandpack.resetAllFiles();
111109
}
110+
refresh();
111+
};
112112

113+
const handleReload = () => {
113114
refresh();
114115
};
115116

@@ -188,7 +189,8 @@ export function NavigationBar({providedFiles}: {providedFiles: Array<string>}) {
188189
className="px-3 flex items-center justify-end text-start"
189190
translate="yes">
190191
<DownloadButton providedFiles={providedFiles} />
191-
<ResetButton onReset={handleReset} />
192+
<ReloadButton onReload={handleReload} />
193+
<ClearButton onClear={handleClear} />
192194
<OpenInCodeSandboxButton />
193195
{activeFile.endsWith('.tsx') && (
194196
<OpenInTypeScriptPlaygroundButton

src/components/MDX/Sandpack/ResetButton.tsx renamed to src/components/MDX/Sandpack/ReloadButton.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@
44

55
import * as React from 'react';
66
import {IconRestart} from '../../Icon/IconRestart';
7-
export interface ResetButtonProps {
8-
onReset: () => void;
7+
export interface ReloadButtonProps {
8+
onReload: () => void;
99
}
1010

11-
export function ResetButton({onReset}: ResetButtonProps) {
11+
export function ReloadButton({onReload}: ReloadButtonProps) {
1212
return (
1313
<button
1414
className="text-sm text-primary dark:text-primary-dark inline-flex items-center hover:text-link duration-100 ease-in transition mx-1"
15-
onClick={onReset}
16-
title="Reset Sandbox"
15+
onClick={onReload}
16+
title="Keep your edits and reload sandbox"
1717
type="button">
18-
<IconRestart className="inline mx-1 relative" /> Reset
18+
<IconRestart className="inline mx-1 relative" />
19+
<span className="hidden md:block">Reload</span>
1920
</button>
2021
);
2122
}

src/content/blog/2025/04/21/react-compiler-rc.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,23 @@ During the RC period, we encourage all React users to try the compiler and provi
5757
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).
5858

5959
## Migrating from eslint-plugin-react-compiler to eslint-plugin-react-hooks {/*migrating-from-eslint-plugin-react-compiler-to-eslint-plugin-react-hooks*/}
60-
If you have already installed eslint-plugin-react-compiler, you can now remove it and use `eslint-plugin-react-hooks@6.0.0-rc.1`. Many thanks to [@michaelfaith](https://bsky.app/profile/michael.faith) for contributing to this improvement!
60+
If you have already installed eslint-plugin-react-compiler, you can now remove it and use `eslint-plugin-react-hooks@rc`. Many thanks to [@michaelfaith](https://bsky.app/profile/michael.faith) for contributing to this improvement!
6161

6262
To install:
6363

6464
npm
6565
<TerminalBlock>
66-
{`npm install --save-dev eslint-plugin-react-hooks@6.0.0-rc.1`}
66+
{`npm install --save-dev eslint-plugin-react-hooks@rc`}
6767
</TerminalBlock>
6868

6969
pnpm
7070
<TerminalBlock>
71-
{`pnpm add --save-dev eslint-plugin-react-hooks@6.0.0-rc.1`}
71+
{`pnpm add --save-dev eslint-plugin-react-hooks@rc`}
7272
</TerminalBlock>
7373

7474
yarn
7575
<TerminalBlock>
76-
{`yarn add --dev eslint-plugin-react-hooks@6.0.0-rc.1`}
76+
{`yarn add --dev eslint-plugin-react-hooks@rc`}
7777
</TerminalBlock>
7878

7979
```js

src/content/community/conferences.md

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,6 @@ Do you know of a local React.js conference? Add it here! (Please keep the list c
1010

1111
## Upcoming Conferences {/*upcoming-conferences*/}
1212

13-
### CityJS London 2025 {/*cityjs-london*/}
14-
April 23 - 25, 2025. In-person in London, UK
15-
16-
[Website](https://london.cityjsconf.org/) - [Twitter](https://x.com/cityjsconf) - [Bluesky](https://bsky.app/profile/cityjsconf.bsky.social)
17-
18-
### App.js Conf 2025 {/*appjs-conf-2025*/}
19-
May 28 - 30, 2025. In-person in Kraków, Poland + remote
20-
21-
[Website](https://appjs.co) - [Twitter](https://twitter.com/appjsconf)
22-
23-
### CityJS Athens 2025 {/*cityjs-athens*/}
24-
May 27 - 31, 2025. In-person in Athens, Greece
25-
26-
[Website](https://athens.cityjsconf.org/) - [Twitter](https://x.com/cityjsconf) - [Bluesky](https://bsky.app/profile/cityjsconf.bsky.social)
27-
28-
### React Norway 2025 {/*react-norway-2025*/}
29-
June 13, 2025. In-person in Oslo, Norway + remote (virtual event)
30-
31-
[Website](https://reactnorway.com/) - [Twitter](https://x.com/ReactNorway)
32-
33-
### React Summit 2025 {/*react-summit-2025*/}
34-
June 13 - 17, 2025. In-person in Amsterdam, Netherlands + remote (hybrid event)
35-
36-
[Website](https://reactsummit.com/) - [Twitter](https://x.com/reactsummit)
37-
38-
### React Nexus 2025 {/*react-nexus-2025*/}
39-
July 03 - 05, 2025. In-person in Bangalore, India
40-
41-
[Website](https://reactnexus.com/) - [Twitter](https://x.com/ReactNexus) - [Bluesky](https://bsky.app/profile/reactnexus.com) - [Linkedin](https://www.linkedin.com/company/react-nexus) - [YouTube](https://www.youtube.com/reactify_in)
42-
4313
### React Universe Conf 2025 {/*react-universe-conf-2025*/}
4414
September 2-4, 2025. Wrocław, Poland.
4515

@@ -60,6 +30,12 @@ October 31 - November 01, 2025. In-person in Goa, India (hybrid event) + Oct 15
6030

6131
[Website](https://www.reactindia.io) - [Twitter](https://twitter.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia) - [Youtube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w)
6232

33+
34+
### CityJS New Delhi 2025 {/*cityjs-newdelhi*/}
35+
November 6-7, 2025. In-person in New Delhi, India
36+
37+
[Website](https://india.cityjsconf.org/) - [Twitter](https://x.com/cityjsconf) - [Bluesky](https://bsky.app/profile/cityjsconf.bsky.social)
38+
6339
### React Summit US 2025 {/*react-summit-us-2025*/}
6440
November 18 - 21, 2025. In-person in New York, USA + remote (hybrid event)
6541

@@ -70,13 +46,49 @@ November 28 & December 1, 2025. In-person in London, UK + online (hybrid event)
7046

7147
[Website](https://reactadvanced.com/) - [Twitter](https://x.com/reactadvanced)
7248

49+
### React Paris 2026 {/*react-paris-2026*/}
50+
March 26 - 27, 2026. In-person in Paris, France (hybrid event)
51+
52+
[Website](https://react.paris/) - [Twitter](https://x.com/BeJS_)
53+
7354

7455
## Past Conferences {/*past-conferences*/}
7556

57+
58+
### React Nexus 2025 {/*react-nexus-2025*/}
59+
July 03 - 05, 2025. In-person in Bangalore, India
60+
61+
[Website](https://reactnexus.com/) - [Twitter](https://x.com/ReactNexus) - [Bluesky](https://bsky.app/profile/reactnexus.com) - [Linkedin](https://www.linkedin.com/company/react-nexus) - [YouTube](https://www.youtube.com/reactify_in)
62+
63+
### React Summit 2025 {/*react-summit-2025*/}
64+
June 13 - 17, 2025. In-person in Amsterdam, Netherlands + remote (hybrid event)
65+
66+
[Website](https://reactsummit.com/) - [Twitter](https://x.com/reactsummit)
67+
68+
### React Norway 2025 {/*react-norway-2025*/}
69+
June 13, 2025. In-person in Oslo, Norway + remote (virtual event)
70+
71+
[Website](https://reactnorway.com/) - [Twitter](https://x.com/ReactNorway)
72+
73+
### CityJS Athens 2025 {/*cityjs-athens*/}
74+
May 27 - 31, 2025. In-person in Athens, Greece
75+
76+
[Website](https://athens.cityjsconf.org/) - [Twitter](https://x.com/cityjsconf) - [Bluesky](https://bsky.app/profile/cityjsconf.bsky.social)
77+
78+
### App.js Conf 2025 {/*appjs-conf-2025*/}
79+
May 28 - 30, 2025. In-person in Kraków, Poland + remote
80+
81+
[Website](https://appjs.co) - [Twitter](https://twitter.com/appjsconf)
82+
83+
### CityJS London 2025 {/*cityjs-london*/}
84+
April 23 - 25, 2025. In-person in London, UK
85+
86+
[Website](https://london.cityjsconf.org/) - [Twitter](https://x.com/cityjsconf) - [Bluesky](https://bsky.app/profile/cityjsconf.bsky.social)
87+
7688
### React Paris 2025 {/*react-paris-2025*/}
7789
March 20 - 21, 2025. In-person in Paris, France (hybrid event)
7890

79-
[Website](https://react.paris/) - [Twitter](https://x.com/BeJS_)
91+
[Website](https://react.paris/) - [Twitter](https://x.com/BeJS_) - [YouTube](https://www.youtube.com/playlist?list=PL53Z0yyYnpWitP8Zv01TSEQmKLvuRh_Dj)
8092

8193
### React Native Connection 2025 {/*react-native-connection-2025*/}
8294
April 3 (Reanimated Training) + April 4 (Conference), 2025. Paris, France.

src/content/learn/react-compiler/installation.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,7 @@ Install the ESLint plugin:
176176
npm install -D eslint-plugin-react-hooks@rc
177177
</TerminalBlock>
178178

179-
Then enable the compiler rule in your ESLint configuration:
180-
181-
```js {3}
182-
// .eslintrc.js
183-
module.exports = {
184-
rules: {
185-
'react-hooks/react-compiler': 'error',
186-
},
187-
};
188-
```
179+
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.
189180

190181
The ESLint rule will:
191182
- Identify violations of the [Rules of React](/reference/rules)

src/content/learn/react-compiler/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Next.js users can enable the swc-invoked React Compiler by using [v15.3.1](https
154154

155155
## What should I do about useMemo, useCallback, and React.memo? {/*what-should-i-do-about-usememo-usecallback-and-reactmemo*/}
156156

157-
If you are using React Compiler, [`useMemo`](/reference/react/useMemo), [`useCallback`](/reference/react/useCallback), and [`React.memo`](/reference/react/memo) can be removed. React Compiler adds automatic memoization more precisely and granularly than is possible with these hooks. 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.
157+
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.
158158

159159
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.
160160

0 commit comments

Comments
 (0)