Skip to content

Commit

Permalink
docs(en): merging all conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
docschina-bot committed Dec 18, 2024
2 parents a8c63a0 + 03e74dd commit 8b6478a
Show file tree
Hide file tree
Showing 24 changed files with 201 additions and 80 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This repo contains the source code and documentation powering [react.dev](https:
### Prerequisites

1. Git
1. Node: any 12.x version starting with v12.0.0 or greater
1. Node: any version starting with v16.8.0 or greater
1. Yarn: See [Yarn website for installation instructions](https://yarnpkg.com/lang/en/docs/install/)
1. A fork of the repo (for any contributions)
1. A clone of the [react.dev repo](https://github.com/reactjs/react.dev) on your local machine
Expand Down
Binary file modified public/images/team/lauren.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/content/blog/2024/04/25/react-19-upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ This will run the following codemods from `react-codemod`:
- [`replace-string-ref`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-string-ref)
- [`replace-act-import`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-act-import)
- [`replace-use-form-state`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-use-form-state)
- [`prop-types-typescript`](TODO)
- [`prop-types-typescript`](https://codemod.com/registry/react-prop-types-typescript)

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

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

<<<<<<< HEAD
__本文的日期已更新,以反映稳定版的发布日期。__
=======
_The date for this post has been updated to reflect the stable release date._
>>>>>>> 03e74dd76bca889f7a608e0a058813fa04710a89
</Note>

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

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

<<<<<<< HEAD
虽然 React 19 中的 React 服务器组件是稳定的,并且在主版本之间不会发生破坏,但用于实现 React 服务器组件打包器或框架的底层 API 不遵循 semver,并可能在 React 19.x 的小版本之间发生破坏。
=======
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.
>>>>>>> 03e74dd76bca889f7a608e0a058813fa04710a89
为了支持 React 服务器组件作为打包器或框架,我们建议固定到特定的 React 版本,或者使用 Canary 发行版。我们将继续与打包器和框架合作,以稳定用于实现 React 服务器组件的 API。

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

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

<<<<<<< HEAD
__注意:这篇文章最初发布于 2024425 日,并已将内容更新至 2024125 日发布的稳定版本。__
=======
_Note: this post was originally published 04/25/2024 and has been updated to 12/05/2024 with the stable release._
>>>>>>> 03e74dd76bca889f7a608e0a058813fa04710a89
73 changes: 42 additions & 31 deletions src/content/community/conferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,62 +10,73 @@ Do you know of a local React.js conference? Add it here! (Please keep the list c

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

### React Universe Conf 2024 {/*react-universe-conf-2024*/}
September 5-6, 2024. Wrocław, Poland.
### React Day Berlin 2024 {/*react-day-berlin-2024*/}
December 13 & 16, 2024. In-person in Berlin, Germany + remote (hybrid event)

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

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

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

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

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

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

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

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

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

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

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

[Website](https://reactnativelondon.co.uk/) - [Twitter](https://x.com/RNLConf)

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

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

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

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

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

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

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

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

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

[Website](https://reactday.berlin/) - [Twitter](https://x.com/reactdayberlin)
[Website](https://rendercon.org/) - [Twitter](https://twitter.com/renderconke) - [LinkedIn](https://www.linkedin.com/company/renderconke/) - [YouTube](https://www.youtube.com/channel/UC0bCcG8gHUL4njDOpQGcMIA)

### React Alicante 2024 {/*react-alicante-2024*/}
September 19-21, 2024. Alicante, Spain.

[Website](https://reactalicante.es/) - [Twitter](https://twitter.com/ReactAlicante) - [YouTube](https://www.youtube.com/channel/UCaSdUaITU1Cz6PvC97A7e0w)

### React Universe Conf 2024 {/*react-universe-conf-2024*/}
September 5-6, 2024. Wrocław, Poland.

[Website](https://www.reactuniverseconf.com/) - [Twitter](https://twitter.com/react_native_eu) - [LinkedIn](https://www.linkedin.com/events/reactuniverseconf7163919537074118657/)

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

### React Rally 2024 🐙 {/*react-rally-2024*/}
August 12-13, 2024. Park City, UT, USA
Expand Down
2 changes: 1 addition & 1 deletion src/content/community/team.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ React 核心团队成员全职致力于核心组件 API 的开发,负责 React
</TeamMember>

<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">
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.
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.
</TeamMember>

<TeamMember name="Luna Wei" permalink="luna-wei" photo="/images/team/luna-wei.jpg" github="lunaleaps" twitter="lunaleaps" threads="lunaleaps" title="Engineer at Meta">
Expand Down
4 changes: 4 additions & 0 deletions src/content/learn/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ translators:

<Intro>

<<<<<<< HEAD
欢迎来到 React 文档!本章节将介绍你每天都会使用的 80% 的 React 概念。
=======
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.
>>>>>>> 03e74dd76bca889f7a608e0a058813fa04710a89
</Intro>

Expand Down
4 changes: 4 additions & 0 deletions src/content/learn/react-compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,11 @@ React Compiler 可以静态验证 React 的许多规则,并且在检测到错

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

<<<<<<< HEAD
[React 开发工具](/learn/react-developer-tools)(v5.0 及以上版本)对 React Compiler 有内置支持,并会在已被编译器优化的组件旁边显示“Memo ✨”徽章。
=======
[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.
>>>>>>> 03e74dd76bca889f7a608e0a058813fa04710a89
### 编译后某些内容无法正常工作 {/*something-is-not-working-after-compilation*/}
如果你安装了 eslint-plugin-react-compiler ,编译器将在你的编辑器中显示任何违反 React 规则的情况。当它这样做时,意味着编译器跳过了对该组件或钩子的优化。这完全没问题,并且编译器可以恢复并继续优化你代码库中的其他组件。**你不必立即修复所有的违反 ESLint 规则的代码。** 你可以按照自己的节奏来处理它们,以增加被优化的组件和钩子的数量。
Expand Down
4 changes: 2 additions & 2 deletions src/content/reference/react-dom/components/form.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ To create interactive controls for submitting information, render the [built-in

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

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

<Sandpack>

Expand Down Expand Up @@ -117,7 +117,7 @@ function AddToCart({productId}) {
}
```

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

### Display a pending state during form submission {/*display-a-pending-state-during-form-submission*/}
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.
Expand Down
19 changes: 17 additions & 2 deletions src/content/reference/react-dom/components/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,13 @@ export default function SiteMapPage() {

### 控制样式表优先级 {/*controlling-stylesheet-precedence*/}

<<<<<<< HEAD
样式表可能会相互冲突,当发生冲突时,浏览器会选择文档中排在后面的样式表。React 允许使用 `precedence` 属性来控制样式表的顺序。在这个例子中,两个组件渲染样式表,具有较高优先级的组件在文档中排在较后位置,即使渲染它的组件出现在较早位置。

{/*FIXME: this doesn't appear to actually work -- I guess precedence isn't implemented yet?*/}
=======
Stylesheets can conflict with each other, and when they do, the browser goes with the one that comes later in the document. React lets you control the order of stylesheets with the `precedence` prop. In this example, three components render stylesheets, and the ones with the same precedence are grouped together in the `<head>`.
>>>>>>> 03e74dd76bca889f7a608e0a058813fa04710a89
<SandpackWithHTMLOutput>

Expand All @@ -165,24 +169,35 @@ export default function HomePage() {
<ShowRenderedHTML>
<FirstComponent />
<SecondComponent />
<ThirdComponent/>
...
</ShowRenderedHTML>
);
}

function FirstComponent() {
return <link rel="stylesheet" href="first.css" precedence="high" />;
return <link rel="stylesheet" href="first.css" precedence="first" />;
}

function SecondComponent() {
return <link rel="stylesheet" href="second.css" precedence="low" />;
return <link rel="stylesheet" href="second.css" precedence="second" />;
}

function ThirdComponent() {
return <link rel="stylesheet" href="third.css" precedence="first" />;
}

```

</SandpackWithHTMLOutput>

<<<<<<< HEAD
### 去除样式表的重复渲染 {/*deduplicated-stylesheet-rendering*/}
=======
Note the `precedence` values themselves are arbitrary and their naming is up to you. React will infer that precedence values it discovers first are "lower" and precedence values it discovers later are "higher".

### Deduplicated stylesheet rendering {/*deduplicated-stylesheet-rendering*/}
>>>>>>> 03e74dd76bca889f7a608e0a058813fa04710a89
如果在多个组件渲染相同的样式表,React 将只在文档头部放置单个 `<link>`

Expand Down
1 change: 0 additions & 1 deletion src/content/reference/react-dom/hooks/useFormStatus.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: useFormStatus
canary: true
---

<Intro>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: prerenderToNodeStream

<Intro>

`prerender` renders a React tree to a static HTML string using a [Node.js Stream.](https://nodejs.org/api/stream.html).
`prerenderToNodeStream` renders a React tree to a static HTML string using a [Node.js Stream.](https://nodejs.org/api/stream.html).

```js
const {prelude} = await prerenderToNodeStream(reactNode, options?)
Expand Down Expand Up @@ -292,4 +292,4 @@ Suspense-enabled data fetching without the use of an opinionated framework is no
The `prerenderToNodeStream` response waits for the entire app to finish rendering, including waiting for all suspense boundaries to resolve, before resolving. It is designed for static site generation (SSG) ahead of time and does not support streaming more content as it loads.
To stream content as it loads, use a streaming server render API like [renderToPipeableStream](/reference/react-dom/server/renderToPipeableStream).
6 changes: 6 additions & 0 deletions src/content/reference/react/Suspense.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,15 @@ async function getAlbums() {

**只有启用了 Suspense 的数据源才会激活 Suspense 组件**,它们包括:

<<<<<<< HEAD
- 支持 Suspense 的框架如 [Relay](https://relay.dev/docs/guided-tour/rendering/loading-states/)[Next.js](https://nextjs.org/docs/getting-started/react-essentials)
- 使用 [`lazy`](/reference/react/lazy) 懒加载组件代码。
- 使用 [`use`](/reference/react/use) 读取缓存的 Promise 值。
=======
- Data fetching with Suspense-enabled frameworks like [Relay](https://relay.dev/docs/guided-tour/rendering/loading-states/) and [Next.js](https://nextjs.org/docs/app/building-your-application/routing/loading-ui-and-streaming#streaming-with-suspense)
- Lazy-loading component code with [`lazy`](/reference/react/lazy)
- Reading the value of a cached Promise with [`use`](/reference/react/use)
>>>>>>> 03e74dd76bca889f7a608e0a058813fa04710a89
Suspense **无法** 检测在 Effect 或事件处理程序中获取数据的情况。

Expand Down
6 changes: 3 additions & 3 deletions src/content/reference/react/act.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ function Counter() {
}

useEffect(() => {
document.title = `You clicked ${this.state.count} times`;
document.title = `You clicked ${count} times`;
}, [count]);

return (
<div>
<p>You clicked {this.state.count} times</p>
<button onClick={this.handleClick}>
<p>You clicked {count} times</p>
<button onClick={handleClick}>
Click me
</button>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/content/reference/react/createContext.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ function Button() {
}
```

<<<<<<< HEAD
尽管这种老方法依然奏效,但 **新代码都应该通过 [`useContext()`](/reference/react/useContext) 来读取上下文**
=======
Although this older way still works, **newly written code should read context with [`useContext()`](/reference/react/useContext) instead:**
>>>>>>> 03e74dd76bca889f7a608e0a058813fa04710a89
```js
function Button() {
Expand Down
Loading

0 comments on commit 8b6478a

Please sign in to comment.