Skip to content

Commit ece1f08

Browse files
Merge branch 'reactjs:main' into learn-editor-setup
2 parents 883006b + 663558d commit ece1f08

26 files changed

+931
-87
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"check-all": "npm-run-all prettier lint:fix tsc"
2323
},
2424
"dependencies": {
25-
"@codesandbox/sandpack-react": "2.6.0",
25+
"@codesandbox/sandpack-react": "2.13.5",
2626
"@docsearch/css": "3.0.0-alpha.41",
2727
"@docsearch/react": "3.0.0-alpha.41",
2828
"@headlessui/react": "^1.7.0",

src/components/MDX/Sandpack/SandpackRoot.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function SandpackRoot(props: SandpackProps) {
8888
autorun,
8989
initMode: 'user-visible',
9090
initModeObserverOptions: {rootMargin: '1400px 0px'},
91-
bundlerURL: 'https://1e4ad8f7.sandpack-bundler-4bw.pages.dev',
91+
bundlerURL: 'https://786946de.sandpack-bundler-4bw.pages.dev',
9292
logLevel: SandpackLogLevel.None,
9393
}}>
9494
<CustomPreset providedFiles={Object.keys(files)} />

src/content/community/conferences.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,22 @@ July 17-19, 2024. In-person in Portland, OR, USA
7070

7171
[Website](https://chainreactconf.com) - [Twitter](https://twitter.com/ChainReactConf)
7272

73+
### The Geek Conf 2024 {/*the-geek-conf-2024*/}
74+
July 25, 2024. In-person in Berlin, Germany + remote (hybrid event)
75+
76+
[Website](https://thegeekconf.com) - [Twitter](https://twitter.com/thegeekconf)
77+
78+
### React Universe Conf 2024 {/*react-universe-conf-2024*/}
79+
September 5-6, 2024. Wrocław, Poland.
80+
81+
[Website](https://www.reactuniverseconf.com/) - [Twitter](https://twitter.com/react_native_eu) - [LinkedIn](https://www.linkedin.com/events/reactuniverseconf7163919537074118657/)
82+
83+
### React Alicante 2024 {/*react-alicante-2024*/}
84+
September 19-21, 2024. Alicante, Spain.
85+
86+
[Website](https://reactalicante.es/) - [Twitter](https://twitter.com/ReactAlicante) - [YouTube](https://www.youtube.com/channel/UCaSdUaITU1Cz6PvC97A7e0w)
87+
88+
7389
### React India 2024 {/*react-india-2024*/}
7490
October 17 - 19, 2024. In-person in Goa, India (hybrid event) + Oct 15 2024 - remote day
7591

src/content/community/team.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Current members of the React team are listed in alphabetical order below.
2222
Andrey started his career as a designer and then gradually transitioned into web development. After joining the React Data team at Meta he worked on adding an incremental JavaScript compiler to Relay, and then later on, worked on removing the same compiler from Relay. Outside of work, Andrey likes to play music and engage in various sports.
2323
</TeamMember>
2424

25-
<TeamMember name="Dan Abramov" permalink="dan-abramov" photo="/images/team/gaearon.jpg" github="gaearon" twitter="dan_abramov" title="Engineer at Meta">
25+
<TeamMember name="Dan Abramov" permalink="dan-abramov" photo="/images/team/gaearon.jpg" github="gaearon" twitter="dan_abramov2" title="Independent Engineer">
2626
Dan got into programming after he accidentally discovered Visual Basic inside Microsoft PowerPoint. He has found his true calling in turning [Sebastian](#sebastian-markbåge)'s tweets into long-form blog posts. Dan occasionally wins at Fortnite by hiding in a bush until the game ends.
2727
</TeamMember>
2828

src/content/learn/choosing-the-state-structure.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,6 @@ button { margin-top: 10px; }
554554

555555
</Sandpack>
556556

557-
(Alternatively, you may hold the selected index in state.)
558-
559557
The state used to be duplicated like this:
560558

561559
* `items = [{ id: 0, title: 'pretzels'}, ...]`

src/content/learn/rendering-lists.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,11 @@ const people = [{
113113
name: 'Mohammad Abdus Salam',
114114
profession: 'physicist',
115115
}, {
116+
id: 3,
116117
name: 'Percy Lavon Julian',
117118
profession: 'chemist',
118119
}, {
120+
id: 4,
119121
name: 'Subrahmanyan Chandrasekhar',
120122
profession: 'astrophysicist',
121123
}];

src/content/learn/typescript.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ TypeScript is a popular way to add type definitions to JavaScript codebases. Out
2222

2323
All [production-grade React frameworks](/learn/start-a-new-react-project#production-grade-react-frameworks) offer support for using TypeScript. Follow the framework specific guide for installation:
2424

25-
- [Next.js](https://nextjs.org/docs/pages/building-your-application/configuring/typescript)
25+
- [Next.js](https://nextjs.org/docs/app/building-your-application/configuring/typescript)
2626
- [Remix](https://remix.run/docs/en/1.19.2/guides/typescript)
2727
- [Gatsby](https://www.gatsbyjs.com/docs/how-to/custom-configuration/typescript/)
2828
- [Expo](https://docs.expo.dev/guides/typescript/)
@@ -435,7 +435,7 @@ interface ModalRendererProps {
435435

436436
Note, that you cannot use TypeScript to describe that the children are a certain type of JSX elements, so you cannot use the type-system to describe a component which only accepts `<li>` children.
437437

438-
You can see all an example of both `React.ReactNode` and `React.ReactElement` with the type-checker in [this TypeScript playground](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgIilQ3wChSB6CxYmAOmXRgDkIATJOdNJMGAZzgwAFpxAR+8YADswAVwGkZMJFEzpOjDKw4AFHGEEBvUnDhphwADZsi0gFw0mDWjqQBuUgF9yaCNMlENzgAXjgACjADfkctFnYkfQhDAEpQgD44AB42YAA3dKMo5P46C2tbJGkvLIpcgt9-QLi3AEEwMFCItJDMrPTTbIQ3dKywdIB5aU4kKyQQKpha8drhhIGzLLWODbNs3b3s8YAxKBQAcwXpAThMaGWDvbH0gFloGbmrgQfBzYpd1YjQZbEYARkB6zMwO2SHSAAlZlYIBCdtCRkZpHIrFYahQYQD8UYYFA5EhcfjyGYqHAXnJAsIUHlOOUbHYhMIIHJzsI0Qk4P9SLUBuRqXEXEwAKKfRZcNA8PiCfxWACecAAUgBlAAacFm80W-CU11U6h4TgwUv11yShjgJjMLMqDnN9Dilq+nh8pD8AXgCHdMrCkWisVoAet0R6fXqhWKhjKllZVVxMcavpd4Zg7U6Qaj+2hmdG4zeRF10uu-Aeq0LBfLMEe-V+T2L7zLVu+FBWLdLeq+lc7DYFf39deFVOotMCACNOCh1dq219a+30uC8YWoZsRyuEdjkevR8uvoVMdjyTWt4WiSSydXD4NqZP4AymeZE072ZzuUeZQKheQgA).
438+
You can see an example of both `React.ReactNode` and `React.ReactElement` with the type-checker in [this TypeScript playground](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgIilQ3wChSB6CxYmAOmXRgDkIATJOdNJMGAZzgwAFpxAR+8YADswAVwGkZMJFEzpOjDKw4AFHGEEBvUnDhphwADZsi0gFw0mDWjqQBuUgF9yaCNMlENzgAXjgACjADfkctFnYkfQhDAEpQgD44AB42YAA3dKMo5P46C2tbJGkvLIpcgt9-QLi3AEEwMFCItJDMrPTTbIQ3dKywdIB5aU4kKyQQKpha8drhhIGzLLWODbNs3b3s8YAxKBQAcwXpAThMaGWDvbH0gFloGbmrgQfBzYpd1YjQZbEYARkB6zMwO2SHSAAlZlYIBCdtCRkZpHIrFYahQYQD8UYYFA5EhcfjyGYqHAXnJAsIUHlOOUbHYhMIIHJzsI0Qk4P9SLUBuRqXEXEwAKKfRZcNA8PiCfxWACecAAUgBlAAacFm80W-CU11U6h4TgwUv11yShjgJjMLMqDnN9Dilq+nh8pD8AXgCHdMrCkWisVoAet0R6fXqhWKhjKllZVVxMcavpd4Zg7U6Qaj+2hmdG4zeRF10uu-Aeq0LBfLMEe-V+T2L7zLVu+FBWLdLeq+lc7DYFf39deFVOotMCACNOCh1dq219a+30uC8YWoZsRyuEdjkevR8uvoVMdjyTWt4WiSSydXD4NqZP4AymeZE072ZzuUeZQKheQgA).
439439

440440
### Style Props {/*typing-style-props*/}
441441

@@ -456,7 +456,7 @@ We recommend the following resources:
456456

457457
- [The TypeScript handbook](https://www.typescriptlang.org/docs/handbook/) is the official documentation for TypeScript, and covers most key language features.
458458

459-
- [The TypeScript release notes](https://devblogs.microsoft.com/typescript/) covers a each new features in-depth.
459+
- [The TypeScript release notes](https://devblogs.microsoft.com/typescript/) cover new features in depth.
460460

461461
- [React TypeScript Cheatsheet](https://react-typescript-cheatsheet.netlify.app/) is a community-maintained cheatsheet for using TypeScript with React, covering a lot of useful edge cases and providing more breadth than this document.
462462

src/content/reference/react-dom/components/link.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Props that are **not recommended** for use with React:
7979

8080
#### Special rendering behavior {/*special-rendering-behavior*/}
8181

82-
React will always place the DOM element corresponding to the `<link>` component within the document’s `<head>`, regardless of where in the React tree it is rendered. The `<head>` is the only valid place for `<link>` to exist within the DOM, yet it’s convenient and keeps things composable if a component representing a specific page can render `<link>` components itself.
82+
React will always place the DOM element corresponding to the `<link>` component within the document’s `<head>`, regardless of where in the React tree it is rendered. The `<head>` is the only valid place for `<link>` to exist within the DOM, yet it’s convenient and keeps things composable if a component representing a specific page can render `<link>` components itself.
8383

8484
There are a few exceptions to this:
8585

@@ -91,7 +91,7 @@ There are a few exceptions to this:
9191

9292
In addition, if the `<link>` is to a stylesheet (namely, it has `rel="stylesheet"` in its props), React treats it specially in the following ways:
9393

94-
* The component that renders `<link>` will [suspend](http://localhost:3000/reference/react/Suspense) while the stylesheet is loading.
94+
* The component that renders `<link>` will [suspend](/reference/react/Suspense) while the stylesheet is loading.
9595
* If multiple components render links to the same stylesheet, React will de-duplicate them and only put a single link into the DOM. Two links are considered the same if they have the same `href` prop.
9696

9797
There are two exception to this special behavior:
@@ -133,7 +133,7 @@ export default function BlogPage() {
133133

134134
### Linking to a stylesheet {/*linking-to-a-stylesheet*/}
135135

136-
If a component depends on a certain stylesheet in order to be displayed correctly, you can render a link to that stylesheet within the component. Your component will [suspend](http://localhost:3000/reference/react/Suspense) while the stylesheet is loading. You must supply the `precedence` prop, which tells React where to place this stylesheet relative to others — stylesheets with higher precedence can override those with lower precedence.
136+
If a component depends on a certain stylesheet in order to be displayed correctly, you can render a link to that stylesheet within the component. Your component will [suspend](/reference/react/Suspense) while the stylesheet is loading. You must supply the `precedence` prop, which tells React where to place this stylesheet relative to others — stylesheets with higher precedence can override those with lower precedence.
137137

138138
<Note>
139139
When you want to use a stylesheet, it can be beneficial to call the [preinit](/reference/react-dom/preinit) function. Calling this function may allow the browser to start fetching the stylesheet earlier than if you just render a `<link>` component, for example by sending an [HTTP Early Hints response](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/103).
@@ -217,7 +217,7 @@ function Component() {
217217

218218
### Annotating specific items within the document with links {/*annotating-specific-items-within-the-document-with-links*/}
219219

220-
You can use the `<link>` component with the `itemProp` prop to annotate specific items within the document with links to related resources. In this case, React will *not* place these annotations within the document `<head>` but will place them like any other React component.
220+
You can use the `<link>` component with the `itemProp` prop to annotate specific items within the document with links to related resources. In this case, React will *not* place these annotations within the document `<head>` but will place them like any other React component.
221221

222222
```js
223223
<section itemScope>

src/content/reference/react-dom/components/style.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Props that are **not recommended** for use with React:
5252

5353
#### Special rendering behavior {/*special-rendering-behavior*/}
5454

55-
React can move `<style>` components to the document's `<head>`, de-duplicate identical stylesheets, and [suspend](http://localhost:3000/reference/react/Suspense) while the stylesheet is loading.
55+
React can move `<style>` components to the document's `<head>`, de-duplicate identical stylesheets, and [suspend](/reference/react/Suspense) while the stylesheet is loading.
5656

5757
To opt into this behavior, provide the `href` and `precedence` props. React will de-duplicate styles if they have the same `href`. The precedence prop tells React where to rank the `<style>` DOM node relative to others in the document `<head>`, which determines which stylesheet can override the other.
5858

src/content/reference/react-dom/hooks/useFormStatus.md

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -182,47 +182,32 @@ import {useFormStatus} from 'react-dom';
182182
export default function UsernameForm() {
183183
const {pending, data} = useFormStatus();
184184

185-
const [showSubmitted, setShowSubmitted] = useState(false);
186-
const submittedUsername = useRef(null);
187-
const timeoutId = useRef(null);
188-
189-
useMemo(() => {
190-
if (pending) {
191-
submittedUsername.current = data?.get('username');
192-
if (timeoutId.current != null) {
193-
clearTimeout(timeoutId.current);
194-
}
195-
196-
timeoutId.current = setTimeout(() => {
197-
timeoutId.current = null;
198-
setShowSubmitted(false);
199-
}, 2000);
200-
setShowSubmitted(true);
201-
}
202-
}, [pending, data]);
203-
204185
return (
205-
<>
206-
<label>Request a Username: </label><br />
207-
<input type="text" name="username" />
186+
<div>
187+
<h3>Request a Username: </h3>
188+
<input type="text" name="username" disabled={pending}/>
208189
<button type="submit" disabled={pending}>
209-
{pending ? 'Submitting...' : 'Submit'}
190+
Submit
210191
</button>
211-
{showSubmitted ? (
212-
<p>Submitted request for username: {submittedUsername.current}</p>
213-
) : null}
214-
</>
192+
<br />
193+
<p>{data ? `Requesting ${data?.get("username")}...`: ''}</p>
194+
</div>
215195
);
216196
}
217197
```
218198
219199
```js src/App.js
220200
import UsernameForm from './UsernameForm';
221201
import { submitForm } from "./actions.js";
202+
import {useRef} from 'react';
222203
223204
export default function App() {
205+
const ref = useRef(null);
224206
return (
225-
<form action={submitForm}>
207+
<form ref={ref} action={async (formData) => {
208+
await submitForm(formData);
209+
ref.current.reset();
210+
}}>
226211
<UsernameForm />
227212
</form>
228213
);
@@ -231,8 +216,22 @@ export default function App() {
231216
232217
```js src/actions.js hidden
233218
export async function submitForm(query) {
234-
await new Promise((res) => setTimeout(res, 1000));
219+
await new Promise((res) => setTimeout(res, 2000));
220+
}
221+
```
222+
223+
```css
224+
p {
225+
height: 14px;
226+
padding: 0;
227+
margin: 2px 0 0 0 ;
228+
font-size: 14px
229+
}
230+
231+
button {
232+
margin-left: 2px;
235233
}
234+
236235
```
237236
238237
```json package.json hidden

0 commit comments

Comments
 (0)