Skip to content

Commit 38ced48

Browse files
committed
docs(en): merging all conflicts
2 parents 0ebe90a + 6ae99dd commit 38ced48

27 files changed

Lines changed: 273 additions & 102 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This repo contains the source code and documentation powering [react.dev](https:
1919
### Prerequisites
2020

2121
1. Git
22-
1. Node: any 12.x version starting with v12.0.0 or greater
22+
1. Node: any version starting with v16.8.0 or greater
2323
1. Yarn: See [Yarn website for installation instructions](https://yarnpkg.com/lang/en/docs/install/)
2424
1. A fork of the repo (for any contributions)
2525
1. A clone of the [react.dev repo](https://github.com/reactjs/react.dev) on your local machine

public/images/team/lauren.jpg

949 KB
Loading

src/content/blog/2024/04/25/react-19-upgrade-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ This will run the following codemods from `react-codemod`:
113113
- [`replace-string-ref`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-string-ref)
114114
- [`replace-act-import`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-act-import)
115115
- [`replace-use-form-state`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-use-form-state)
116-
- [`prop-types-typescript`](TODO)
116+
- [`prop-types-typescript`](https://codemod.com/registry/react-prop-types-typescript)
117117

118118
This does not include the TypeScript changes. See [TypeScript changes](#typescript-changes) below.
119119

src/content/blog/2024/12/05/react-19.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ description: React 19 版现在可以在 npm 上使用了! 在这篇文章中,
1717
- **预热 suspend 树**:阅读 [改善 Suspense](/blog/2024/04/25/react-19-upgrade-guide#improvements-to-suspense) 来了解更多。
1818
- **React DOM 静态 API**:阅读 [新的 React DOM 静态 API](#new-react-dom-static-apis) 来了解更多。
1919

20+
<<<<<<< HEAD
2021
__本文的日期已更新,以反映稳定版的发布日期。__
22+
=======
23+
_The date for this post has been updated to reflect the stable release date._
24+
>>>>>>> 6ae99dddc3b503233291da96e8fd4b118ed6d682
2125
2226
</Note>
2327

@@ -362,7 +366,11 @@ React 19 包含了所有从 Canary 渠道引入的 React 服务器组件功能
362366

363367
#### 如何构建对服务器组件的支持? {/*how-do-i-build-support-for-server-components*/}
364368

369+
<<<<<<< HEAD
365370
虽然 React 19 中的 React 服务器组件是稳定的,并且在主版本之间不会发生破坏,但用于实现 React 服务器组件打包器或框架的底层 API 不遵循 semver,并可能在 React 19.x 的小版本之间发生破坏。
371+
=======
372+
While React Server Components in React 19 are stable and will not break between minor versions, the underlying APIs used to implement a React Server Components bundler or framework do not follow semver and may break between minors in React 19.x.
373+
>>>>>>> 6ae99dddc3b503233291da96e8fd4b118ed6d682
366374
367375
为了支持 React 服务器组件作为打包器或框架,我们建议固定到特定的 React 版本,或者使用 Canary 发行版。我们将继续与打包器和框架合作,以稳定用于实现 React 服务器组件的 API。
368376

@@ -807,4 +815,8 @@ React 19 添加了对自定义元素的全面支持,并通过了 [Custom Eleme
807815

808816
请查看 [React 19 升级指南](/blog/2024/04/25/react-19-upgrade-guide) 以获取逐步指导和完整的破坏性和显著变化列表。
809817

818+
<<<<<<< HEAD
810819
__注意:这篇文章最初发布于 2024425 日,并已将内容更新至 2024125 日发布的稳定版本。__
820+
=======
821+
_Note: this post was originally published 04/25/2024 and has been updated to 12/05/2024 with the stable release._
822+
>>>>>>> 6ae99dddc3b503233291da96e8fd4b118ed6d682

src/content/community/conferences.md

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,62 +10,73 @@ 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-
### React Universe Conf 2024 {/*react-universe-conf-2024*/}
14-
September 5-6, 2024. Wrocław, Poland.
13+
### React Day Berlin 2024 {/*react-day-berlin-2024*/}
14+
December 13 & 16, 2024. In-person in Berlin, Germany + remote (hybrid event)
1515

16-
[Website](https://www.reactuniverseconf.com/) - [Twitter](https://twitter.com/react_native_eu) - [LinkedIn](https://www.linkedin.com/events/reactuniverseconf7163919537074118657/)
16+
[Website](https://reactday.berlin/) - [Twitter](https://x.com/reactdayberlin)
1717

18-
### React Alicante 2024 {/*react-alicante-2024*/}
19-
September 19-21, 2024. Alicante, Spain.
18+
### App.js Conf 2025 {/*appjs-conf-2025*/}
19+
May 28 - 30, 2025. In-person in Kraków, Poland + remote
2020

21-
[Website](https://reactalicante.es/) - [Twitter](https://twitter.com/ReactAlicante) - [YouTube](https://www.youtube.com/channel/UCaSdUaITU1Cz6PvC97A7e0w)
21+
[Website](https://appjs.co) - [Twitter](https://twitter.com/appjsconf)
2222

23-
### RenderCon Kenya 2024 {/*rendercon-kenya-2024*/}
24-
October 04 - 05, 2024. Nairobi, Kenya
23+
### React Summit 2025 {/*react-summit-2025*/}
24+
June 13 - 17, 2025. In-person in Amsterdam, Netherlands + remote (hybrid event)
2525

26-
[Website](https://rendercon.org/) - [Twitter](https://twitter.com/renderconke) - [LinkedIn](https://www.linkedin.com/company/renderconke/) - [YouTube](https://www.youtube.com/channel/UC0bCcG8gHUL4njDOpQGcMIA)
26+
[Website](https://reactsummit.com/) - [Twitter](https://x.com/reactsummit)
2727

28-
### React India 2024 {/*react-india-2024*/}
29-
October 17 - 19, 2024. In-person in Goa, India (hybrid event) + Oct 15 2024 - remote day
28+
## Past Conferences {/*past-conferences*/}
3029

31-
[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)
30+
### React Africa 2024 {/*react-africa-2024*/}
31+
November 29, 2024. In-person in Casablanca, Morocco (hybrid event)
3232

33-
### React Brussels 2024 {/*react-brussels-2024*/}
34-
October 18, 2024. In-person in Brussels, Belgium (hybrid event)
33+
[Website](https://react-africa.com/) - [Twitter](https://x.com/BeJS_)
3534

36-
[Website](https://www.react.brussels/) - [Twitter](https://x.com/BrusselsReact)
35+
### React Summit US 2024 {/*react-summit-us-2024*/}
36+
November 19 & 22, 2024. In-person in New York, USA + online (hybrid event)
3737

38-
### reactjsday 2024 {/*reactjsday-2024*/}
39-
October 25, 2024. In-person in Verona, Italy + online (hybrid event)
38+
[Website](https://reactsummit.us/) - [Twitter](https://twitter.com/reactsummit) - [Videos](https://portal.gitnation.org/)
4039

41-
[Website](https://2024.reactjsday.it/) - [Twitter](https://x.com/reactjsday) - [Facebook](https://www.facebook.com/GrUSP/) - [YouTube](https://www.youtube.com/c/grusp)
40+
### React Native London Conf 2024 {/*react-native-london-2024*/}
41+
November 14 & 15, 2024. In-person in London, UK
42+
43+
[Website](https://reactnativelondon.co.uk/) - [Twitter](https://x.com/RNLConf)
4244

4345
### React Advanced London 2024 {/*react-advanced-london-2024*/}
4446
October 25 & 28, 2024. In-person in London, UK + online (hybrid event)
4547

4648
[Website](https://reactadvanced.com/) - [Twitter](https://x.com/reactadvanced)
4749

48-
### React Native London Conf 2024 {/*react-native-london-2024*/}
49-
November 14 & 15, 2024. In-person in London, UK
50+
### reactjsday 2024 {/*reactjsday-2024*/}
51+
October 25, 2024. In-person in Verona, Italy + online (hybrid event)
5052

51-
[Website](https://reactnativelondon.co.uk/) - [Twitter](https://x.com/RNLConf)
53+
[Website](https://2024.reactjsday.it/) - [Twitter](https://x.com/reactjsday) - [Facebook](https://www.facebook.com/GrUSP/) - [YouTube](https://www.youtube.com/c/grusp)
5254

53-
### React Summit US 2024 {/*react-summit-us-2024*/}
54-
November 19 & 22, 2024. In-person in New York, USA + online (hybrid event)
55+
### React Brussels 2024 {/*react-brussels-2024*/}
56+
October 18, 2024. In-person in Brussels, Belgium (hybrid event)
5557

56-
[Website](https://reactsummit.us/) - [Twitter](https://twitter.com/reactsummit) - [Videos](https://portal.gitnation.org/)
58+
[Website](https://www.react.brussels/) - [Twitter](https://x.com/BrusselsReact)
5759

58-
### React Africa 2024 {/*react-africa-2024*/}
59-
November 29, 2024. In-person in Casablanca, Morocco (hybrid event)
60+
### React India 2024 {/*react-india-2024*/}
61+
October 17 - 19, 2024. In-person in Goa, India (hybrid event) + Oct 15 2024 - remote day
6062

61-
[Website](https://react-africa.com/) - [Twitter](https://x.com/BeJS_)
63+
[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)
6264

63-
### React Day Berlin 2024 {/*react-day-berlin-2024*/}
64-
December 13 & 16, 2024. In-person in Berlin, Germany + remote (hybrid event)
65+
### RenderCon Kenya 2024 {/*rendercon-kenya-2024*/}
66+
October 04 - 05, 2024. Nairobi, Kenya
6567

66-
[Website](https://reactday.berlin/) - [Twitter](https://x.com/reactdayberlin)
68+
[Website](https://rendercon.org/) - [Twitter](https://twitter.com/renderconke) - [LinkedIn](https://www.linkedin.com/company/renderconke/) - [YouTube](https://www.youtube.com/channel/UC0bCcG8gHUL4njDOpQGcMIA)
69+
70+
### React Alicante 2024 {/*react-alicante-2024*/}
71+
September 19-21, 2024. Alicante, Spain.
72+
73+
[Website](https://reactalicante.es/) - [Twitter](https://twitter.com/ReactAlicante) - [YouTube](https://www.youtube.com/channel/UCaSdUaITU1Cz6PvC97A7e0w)
74+
75+
### React Universe Conf 2024 {/*react-universe-conf-2024*/}
76+
September 5-6, 2024. Wrocław, Poland.
77+
78+
[Website](https://www.reactuniverseconf.com/) - [Twitter](https://twitter.com/react_native_eu) - [LinkedIn](https://www.linkedin.com/events/reactuniverseconf7163919537074118657/)
6779

68-
## Past Conferences {/*past-conferences*/}
6980

7081
### React Rally 2024 🐙 {/*react-rally-2024*/}
7182
August 12-13, 2024. Park City, UT, USA

src/content/community/team.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ React 核心团队成员全职致力于核心组件 API 的开发,负责 React
4343
</TeamMember>
4444

4545
<TeamMember name="Lauren Tan" permalink="lauren-tan" photo="/images/team/lauren.jpg" github="poteto" twitter="potetotes" threads="potetotes" bsky="no.lol" title="Engineer at Meta">
46-
Lauren's programming career peaked when she first discovered the `<marquee>` tag. She’s been chasing that high ever since. She studied Finance instead of CS in college, so she learned to code using Excel instead of Java. Lauren enjoys dropping cheeky memes in chat, playing video games with her partner, and petting her dog Zelda.
46+
Lauren's programming career peaked when she first discovered the `<marquee>` tag. She’s been chasing that high ever since. She studied Finance instead of CS in college, so she learned to code using Excel. Lauren enjoys dropping cheeky memes in chat, playing video games with her partner, learning Korean, and petting her dog Zelda.
4747
</TeamMember>
4848

4949
<TeamMember name="Luna Wei" permalink="luna-wei" photo="/images/team/luna-wei.jpg" github="lunaleaps" twitter="lunaleaps" threads="lunaleaps" title="Engineer at Meta">

src/content/learn/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ translators:
1010

1111
<Intro>
1212

13+
<<<<<<< HEAD
1314
欢迎来到 React 文档!本章节将介绍你每天都会使用的 80% 的 React 概念。
15+
=======
16+
Welcome to the React documentation! This page will give you an introduction to 80% of the React concepts that you will use on a daily basis.
17+
>>>>>>> 6ae99dddc3b503233291da96e8fd4b118ed6d682
1418
1519
</Intro>
1620

src/content/learn/manipulating-the-dom-with-refs.md

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -345,17 +345,42 @@ li {
345345

346346
## 访问另一个组件的 DOM 节点 {/*accessing-another-components-dom-nodes*/}
347347

348+
<<<<<<< HEAD
348349
当你将 ref 放在像 `<input />` 这样输出浏览器元素的内置组件上时,React 会将该 ref 的 `current` 属性设置为相应的 DOM 节点(例如浏览器中实际的 `<input />` )。
349350

350351
但是,如果你尝试将 ref 放在 **你自己的** 组件上,例如 `<MyInput />`,默认情况下你会得到 `null`。这个示例演示了这种情况。请注意单击按钮 **并不会** 聚焦输入框:
352+
=======
353+
<Pitfall>
354+
Refs are an escape hatch. Manually manipulating _another_ component's DOM nodes can make your code fragile.
355+
</Pitfall>
356+
357+
You can pass refs from parent component to child components [just like any other prop](/learn/passing-props-to-a-component).
358+
359+
```js {3-4,9}
360+
import { useRef } from 'react';
361+
362+
function MyInput({ ref }) {
363+
return <input ref={ref} />;
364+
}
365+
366+
function MyForm() {
367+
const inputRef = useRef(null);
368+
return <MyInput ref={inputRef} />
369+
}
370+
```
371+
372+
In the above example, a ref is created in the parent component, `MyForm`, and is passed to the child component, `MyInput`. `MyInput` then passes the ref to `<input>`. Because `<input>` is a [built-in component](/reference/react-dom/components/common) React sets the `.current` property of the ref to the `<input>` DOM element.
373+
374+
The `inputRef` created in `MyForm` now points to the `<input>` DOM element returned by `MyInput`. A click handler created in `MyForm` can access `inputRef` and call `focus()` to set the focus on `<input>`.
375+
>>>>>>> 6ae99dddc3b503233291da96e8fd4b118ed6d682
351376
352377
<Sandpack>
353378

354379
```js
355380
import { useRef } from 'react';
356381

357-
function MyInput(props) {
358-
return <input {...props} />;
382+
function MyInput({ ref }) {
383+
return <input ref={ref} />;
359384
}
360385

361386
export default function MyForm() {
@@ -378,6 +403,7 @@ export default function MyForm() {
378403

379404
</Sandpack>
380405

406+
<<<<<<< HEAD
381407
为了帮助你注意到这个问题,React 还会向控制台打印一条错误消息:
382408

383409
<ConsoleBlock level="error">
@@ -435,31 +461,33 @@ export default function Form() {
435461

436462
在设计系统中,将低级组件(如按钮、输入框等)的 ref 转发到它们的 DOM 节点是一种常见模式。另一方面,像表单、列表或页面段落这样的高级组件通常不会暴露它们的 DOM 节点,以避免对 DOM 结构的意外依赖。
437463

464+
=======
465+
>>>>>>> 6ae99dddc3b503233291da96e8fd4b118ed6d682
438466
<DeepDive>
439467
440468
#### 使用命令句柄暴露一部分 API {/*exposing-a-subset-of-the-api-with-an-imperative-handle*/}
441469

470+
<<<<<<< HEAD
442471
在上面的例子中,`MyInput` 暴露了原始的 DOM 元素 input。这让父组件可以对其调用`focus()`。然而,这也让父组件能够做其他事情 —— 例如,改变其 CSS 样式。在一些不常见的情况下,你可能希望限制暴露的功能。你可以用 `useImperativeHandle` 做到这一点:
472+
=======
473+
In the above example, the ref passed to `MyInput` is passed on to the original DOM input element. This lets the parent component call `focus()` on it. However, this also lets the parent component do something else--for example, change its CSS styles. In uncommon cases, you may want to restrict the exposed functionality. You can do that with [`useImperativeHandle`](/reference/react/useImperativeHandle):
474+
>>>>>>> 6ae99dddc3b503233291da96e8fd4b118ed6d682
443475
444476
<Sandpack>
445477

446478
```js
447-
import {
448-
forwardRef,
449-
useRef,
450-
useImperativeHandle
451-
} from 'react';
479+
import { useRef, useImperativeHandle } from "react";
452480

453-
const MyInput = forwardRef((props, ref) => {
481+
function MyInput({ ref }) {
454482
const realInputRef = useRef(null);
455483
useImperativeHandle(ref, () => ({
456484
// 只暴露 focus,没有别的
457485
focus() {
458486
realInputRef.current.focus();
459487
},
460488
}));
461-
return <input {...props} ref={realInputRef} />;
462-
});
489+
return <input ref={realInputRef} />;
490+
};
463491

464492
export default function Form() {
465493
const inputRef = useRef(null);
@@ -471,17 +499,25 @@ export default function Form() {
471499
return (
472500
<>
473501
<MyInput ref={inputRef} />
502+
<<<<<<< HEAD
474503
<button onClick={handleClick}>
475504
聚焦输入框
476505
</button>
506+
=======
507+
<button onClick={handleClick}>Focus the input</button>
508+
>>>>>>> 6ae99dddc3b503233291da96e8fd4b118ed6d682
477509
</>
478510
);
479511
}
480512
```
481513

482514
</Sandpack>
483515

516+
<<<<<<< HEAD
484517
这里,`MyInput` 中的 `realInputRef` 保存了实际的 input DOM 节点。 但是,`useImperativeHandle` 指示 React 将你自己指定的对象作为父组件的 ref 值。 所以 `Form` 组件内的 `inputRef.current` 将只有 `focus` 方法。在这种情况下,ref “句柄”不是 DOM 节点,而是你在 `useImperativeHandle` 调用中创建的自定义对象。
518+
=======
519+
Here, `realInputRef` inside `MyInput` holds the actual input DOM node. However, [`useImperativeHandle`](/reference/react/useImperativeHandle) instructs React to provide your own special object as the value of a ref to the parent component. So `inputRef.current` inside the `Form` component will only have the `focus` method. In this case, the ref "handle" is not the DOM node, but the custom object you create inside [`useImperativeHandle`](/reference/react/useImperativeHandle) call.
520+
>>>>>>> 6ae99dddc3b503233291da96e8fd4b118ed6d682
485521
486522
</DeepDive>
487523

@@ -593,7 +629,7 @@ export default function TodoList() {
593629
const newTodo = { id: nextId++, text: text };
594630
flushSync(() => {
595631
setText('');
596-
setTodos([ ...todos, newTodo]);
632+
setTodos([ ...todos, newTodo]);
597633
});
598634
listRef.current.lastChild.scrollIntoView({
599635
behavior: 'smooth',

src/content/learn/react-compiler.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,11 @@ React Compiler 可以静态验证 React 的许多规则,并且在检测到错
348348

349349
### 我如何知道我的组件已被优化? {/*how-do-i-know-my-components-have-been-optimized*/}
350350

351+
<<<<<<< HEAD
351352
[React 开发工具](/learn/react-developer-tools)(v5.0 及以上版本)对 React Compiler 有内置支持,并会在已被编译器优化的组件旁边显示“Memo ✨”徽章。
353+
=======
354+
[React DevTools](/learn/react-developer-tools) (v5.0+) and [React Native DevTools](https://reactnative.dev/docs/react-native-devtools) have built-in support for React Compiler and will display a "Memo ✨" badge next to components that have been optimized by the compiler.
355+
>>>>>>> 6ae99dddc3b503233291da96e8fd4b118ed6d682
352356
353357
### 编译后某些内容无法正常工作 {/*something-is-not-working-after-compilation*/}
354358
如果你安装了 eslint-plugin-react-compiler ,编译器将在你的编辑器中显示任何违反 React 规则的情况。当它这样做时,意味着编译器跳过了对该组件或钩子的优化。这完全没问题,并且编译器可以恢复并继续优化你代码库中的其他组件。**你不必立即修复所有的违反 ESLint 规则的代码。** 你可以按照自己的节奏来处理它们,以增加被优化的组件和钩子的数量。

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ To create interactive controls for submitting information, render the [built-in
5050

5151
### Handle form submission on the client {/*handle-form-submission-on-the-client*/}
5252

53-
Pass a function to the `action` prop of form to run the function when the form is submitted. [`formData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) will be passed to the function as an argument so you can access the data submitted by the form. This differs from the conventional [HTML action](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#action), which only accepts URLs.
53+
Pass a function to the `action` prop of form to run the function when the form is submitted. [`formData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) will be passed to the function as an argument so you can access the data submitted by the form. This differs from the conventional [HTML action](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#action), which only accepts URLs. After the `action` function succeeds, all uncontrolled field elements in the form are reset.
5454

5555
<Sandpack>
5656

@@ -117,7 +117,7 @@ function AddToCart({productId}) {
117117
}
118118
```
119119

120-
When `<form>` is rendered by a [Server Component](/reference/rsc/use-client), and a [Server Function](/reference/rsc/server-function) is passed to the `<form>`'s `action` prop, the form is [progressively enhanced](https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement).
120+
When `<form>` is rendered by a [Server Component](/reference/rsc/use-client), and a [Server Function](/reference/rsc/server-functions) is passed to the `<form>`'s `action` prop, the form is [progressively enhanced](https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement).
121121

122122
### Display a pending state during form submission {/*display-a-pending-state-during-form-submission*/}
123123
To display a pending state when a form is being submitted, you can call the `useFormStatus` Hook in a component rendered in a `<form>` and read the `pending` property returned.

0 commit comments

Comments
 (0)