Skip to content

Commit edc6ba6

Browse files
authored
fix conflict
1 parent bb13c15 commit edc6ba6

File tree

5 files changed

+22
-90
lines changed

5 files changed

+22
-90
lines changed

src/content/blog/index.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@ title: React Blog
1111

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

14-
<<<<<<< HEAD
15-
<BlogCard title="服务器组件中的严重安全漏洞" date="2025 年 12 月 3 日" url="/blog/2025/12/03/critical-security-vulnerability-in-react-server-components">
16-
=======
17-
<BlogCard title="Denial of Service and Source Code Exposure in React Server Components" date="December 11, 2025" url="/blog/2025/12/11/denial-of-service-and-source-code-exposure-in-react-server-components">
14+
<BlogCard title="React 服务器组件中的拒绝服务和源代码泄露" date="2025 年 12 月 11 日" url="/blog/2025/12/11/denial-of-service-and-source-code-exposure-in-react-server-components">
1815

19-
Security researchers have found and disclosed two additional vulnerabilities in React Server Components while attempting to exploit the patches in last week’s critical vulnerability...
16+
安全研究员在尝试利用上周公布的严重漏洞补丁时,又发现了 React 服务器组件中的两个漏洞并进行披露……
2017

2118
</BlogCard>
2219

23-
<BlogCard title="Critical Security Vulnerability in React Server Components" date="December 3, 2025" url="/blog/2025/12/03/critical-security-vulnerability-in-react-server-components">
24-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
20+
<BlogCard title="服务器组件中的严重安全漏洞" date="2025 年 12 月 3 日" url="/blog/2025/12/03/critical-security-vulnerability-in-react-server-components">
2521

2622
服务器组件中存在未经身份验证的远程代码执行漏洞。版本 19.0.1、19.1.2 和 19.2.1 已经修复该漏洞。我们建议立即升级。
2723

src/content/reference/react/useEffect.md

Lines changed: 12 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,9 @@ function ChatRoom({ roomId }) {
4444
4545
#### 参数 {/*parameters*/}
4646
47-
<<<<<<< HEAD
48-
* `setup`:处理 Effect 的函数。setup 函数选择性返回一个 **清理(cleanup)** 函数。当组件被添加到 DOM 的时候,React 将运行 setup 函数。在每次依赖项变更重新渲染后,React 将首先使用旧值运行 cleanup 函数(如果你提供了该函数),然后使用新值运行 setup 函数。在组件从 DOM 中移除后,React 将最后一次运行 cleanup 函数。
47+
* `setup`:处理 Effect 的函数。setup 函数选择性返回一个 **清理(cleanup)** 函数。当 [组件提交的时候](/learn/render-and-commit#step-3-react-commits-changes-to-the-dom),React 会运行 setup 函数。在每次提交导致依赖项变更后,React 将首先使用旧值运行 cleanup 函数(如果你提供了该函数),然后使用新值运行 setup 函数。在组件从 DOM 中移除后,React 将最后一次运行 cleanup 函数。
4948
50-
* **可选** `dependencies``setup` 代码中引用的所有响应式值的列表。响应式值包括 props、state 以及所有直接在组件内部声明的变量和函数。如果你的代码检查工具 [配置了 React](/learn/editor-setup#linting),那么它将验证是否每个响应式值都被正确地指定为一个依赖项。依赖项列表的元素数量必须是固定的,并且必须像 `[dep1, dep2, dep3]` 这样内联编写。React 将使用 [`Object.is`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/is) 来比较每个依赖项和它先前的值。如果省略此参数,则在每次重新渲染组件之后,将重新运行 Effect 函数。如果你想了解更多,请参见 [传递依赖数组、空数组和不传递依赖项之间的区别](#examples-dependencies)。
51-
=======
52-
* `setup`: The function with your Effect's logic. Your setup function may also optionally return a *cleanup* function. When your [component commits](/learn/render-and-commit#step-3-react-commits-changes-to-the-dom), React will run your setup function. After every commit with changed dependencies, React will first run the cleanup function (if you provided it) with the old values, and then run your setup function with the new values. After your component is removed from the DOM, React will run your cleanup function.
53-
54-
* **optional** `dependencies`: The list of all reactive values referenced inside of the `setup` code. Reactive values include props, state, and all the variables and functions declared directly inside your component body. If your linter is [configured for React](/learn/editor-setup#linting), it will verify that every reactive value is correctly specified as a dependency. The list of dependencies must have a constant number of items and be written inline like `[dep1, dep2, dep3]`. React will compare each dependency with its previous value using the [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) comparison. If you omit this argument, your Effect will re-run after every commit of the component. [See the difference between passing an array of dependencies, an empty array, and no dependencies at all.](#examples-dependencies)
55-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
49+
* **可选** `dependencies``setup` 代码中引用的所有响应式值的列表。响应式值包括 props、state 以及所有直接在组件内部声明的变量和函数。如果你的代码检查工具 [配置了 React](/learn/editor-setup#linting),那么它将验证是否每个响应式值都被正确地指定为一个依赖项。依赖项列表的元素数量必须是固定的,并且必须像 `[dep1, dep2, dep3]` 这样内联编写。React 将使用 [`Object.is`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/is) 来比较每个依赖项和它先前的值。如果省略此参数,则在每次组件提交更改之后,将重新运行 Effect 函数。如果你想了解更多,请参见 [传递依赖数组、空数组和不传递依赖项之间的区别](#examples-dependencies)。
5650
5751
#### 返回值 {/*returns*/}
5852
@@ -112,27 +106,15 @@ function ChatRoom({ roomId }) {
112106
113107
**React 在必要时会调用 setup 和 cleanup,这可能会发生多次**:
114108
115-
<<<<<<< HEAD
116109
1. 将组件挂载到页面时,将运行 <CodeStep step={1}>setup 代码</CodeStep>。
117-
2. 重新渲染 <CodeStep step={3}>依赖项</CodeStep> 变更的组件后
110+
2. 如果组件提交导致 <CodeStep step={3}>依赖项</CodeStep> 被改变
118111
- 首先,使用旧的 props 和 state 运行 <CodeStep step={2}>cleanup 代码</CodeStep>。
119112
- 然后,使用新的 props 和 state 运行 <CodeStep step={1}>setup 代码</CodeStep>。
120113
3. 当组件从页面卸载后,<CodeStep step={2}>cleanup 代码</CodeStep> 将运行最后一次。
121-
=======
122-
1. Your <CodeStep step={1}>setup code</CodeStep> runs when your component is added to the page *(mounts)*.
123-
2. After every commit of your component where the <CodeStep step={3}>dependencies</CodeStep> have changed:
124-
- First, your <CodeStep step={2}>cleanup code</CodeStep> runs with the old props and state.
125-
- Then, your <CodeStep step={1}>setup code</CodeStep> runs with the new props and state.
126-
3. Your <CodeStep step={2}>cleanup code</CodeStep> runs one final time after your component is removed from the page *(unmounts).*
127-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
128114
129115
**用上面的代码作为例子来解释这个顺序**。
130116
131-
<<<<<<< HEAD
132-
`ChatRoom` 组件添加到页面中时,它将使用 `serverUrl``roomId` 初始值连接到聊天室。如果 `serverUrl` 或者 `roomId` 发生改变并导致重新渲染(比如用户在下拉列表中选择了一个不同的聊天室),那么 Effect 就会 **断开与前一个聊天室的连接,并连接到下一个聊天室**。当 `ChatRoom` 组件从页面中卸载时,你的 Effect 将最后一次断开连接。
133-
=======
134-
When the `ChatRoom` component above gets added to the page, it will connect to the chat room with the initial `serverUrl` and `roomId`. If either `serverUrl` or `roomId` change as a result of a commit (say, if the user picks a different chat room in a dropdown), your Effect will *disconnect from the previous room, and connect to the next one.* When the `ChatRoom` component is removed from the page, your Effect will disconnect one last time.
135-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
117+
`ChatRoom` 组件添加到页面中时,它将使用 `serverUrl``roomId` 初始值连接到聊天室。如果 `serverUrl` 或者 `roomId` 发生改变并导致提交(比如用户在下拉列表中选择了一个不同的聊天室),那么 Effect 就会 **断开与前一个聊天室的连接,并连接到下一个聊天室**。当 `ChatRoom` 组件从页面中卸载时,你的 Effect 将最后一次断开连接。
136118
137119
**为了 [帮助你发现 bug](/learn/synchronizing-with-effects#step-3-add-cleanup-if-needed),在开发环境下,React 在运行 <CodeStep step={1}>setup</CodeStep> 之前会额外运行一次<CodeStep step={1}>setup</CodeStep> 和 <CodeStep step={2}>cleanup</CodeStep>**。这是一个压力测试,用于验证 Effect 逻辑是否正确实现。如果这会导致可见的问题,那么你的 cleanup 函数就缺少一些逻辑。cleanup 函数应该停止或撤消 setup 函数正在执行的任何操作。一般来说,用户不应该能够区分只调用一次 setup(在生产环境中)与调用 *setup* → *cleanup* → *setup* 序列(在开发环境中)。[查看常见解决方案](/learn/synchronizing-with-effects#how-to-handle-the-effect-firing-twice-in-development)。
138120
@@ -1163,11 +1145,7 @@ useEffect(() => {
11631145
11641146
#### 传递依赖项数组 {/*passing-a-dependency-array*/}
11651147
1166-
<<<<<<< HEAD
1167-
如果指定了依赖项,则 Effect 在 **初始渲染后以及依赖项变更的重新渲染后** 运行。
1168-
=======
1169-
If you specify the dependencies, your Effect runs **after the initial commit _and_ after commits with changed dependencies.**
1170-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
1148+
如果指定了依赖项,则 Effect 在 **初始提交后以及提交导致了依赖项变更后** 运行。
11711149
11721150
```js {3}
11731151
useEffect(() => {
@@ -1264,11 +1242,7 @@ button { margin-left: 5px; }
12641242
12651243
#### 传递空依赖项数组 {/*passing-an-empty-dependency-array*/}
12661244
1267-
<<<<<<< HEAD
1268-
如果你的 Effect 确实没有使用任何响应式值,则它仅在 **初始渲染后** 运行。
1269-
=======
1270-
If your Effect truly doesn't use any reactive values, it will only run **after the initial commit.**
1271-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
1245+
如果你的 Effect 确实没有使用任何响应式值,则它仅在 **初始提交后** 运行。
12721246
12731247
```js {3}
12741248
useEffect(() => {
@@ -1345,11 +1319,7 @@ export function createConnection(serverUrl, roomId) {
13451319
13461320
#### 不传递依赖项数组 {/*passing-no-dependency-array-at-all*/}
13471321
1348-
<<<<<<< HEAD
1349-
如果完全不传递依赖数组,则 Effect 会在组件的 **每次单独渲染(和重新渲染)之后** 运行。
1350-
=======
1351-
If you pass no dependency array at all, your Effect runs **after every single commit** of your component.
1352-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
1322+
如果完全不传递依赖数组,则 Effect 会在组件的 **每次单独提交之后** 运行。
13531323
13541324
```js {3}
13551325
useEffect(() => {
@@ -1510,11 +1480,7 @@ body {
15101480
15111481
### 删除不必要的对象依赖项 {/*removing-unnecessary-object-dependencies*/}
15121482
1513-
<<<<<<< HEAD
1514-
如果你的 Effect 依赖于在渲染期间创建的对象或函数,则它可能会频繁运行。例如,此 Effect 在每次渲染后都重新连接,因为 `options` 对象 [每次渲染都不同](/learn/removing-effect-dependencies#does-some-reactive-value-change-unintentionally):
1515-
=======
1516-
If your Effect depends on an object or a function created during rendering, it might run too often. For example, this Effect re-connects after every commit because the `options` object is [different for every render:](/learn/removing-effect-dependencies#does-some-reactive-value-change-unintentionally)
1517-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
1483+
如果你的 Effect 依赖于在渲染期间创建的对象或函数,则它可能会频繁运行。例如,此 Effect 在每次提交后都重新连接,因为 `options` 对象 [每次渲染都不同](/learn/removing-effect-dependencies#does-some-reactive-value-change-unintentionally):
15181484
15191485
```js {6-9,12,15}
15201486
const serverUrl = 'https://localhost:1234';
@@ -1531,11 +1497,7 @@ function ChatRoom({ roomId }) {
15311497
const connection = createConnection(options); // 它在 Effect 内部使用
15321498
connection.connect();
15331499
return () => connection.disconnect();
1534-
<<<<<<< HEAD
1535-
}, [options]); // 🚩 因此,这些依赖在重新渲染时总是不同的
1536-
=======
1537-
}, [options]); // 🚩 As a result, these dependencies are always different on a commit
1538-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
1500+
}, [options]); // 🚩 因此,这些依赖在每次提交时总是不同的
15391501
// ...
15401502
```
15411503
@@ -1621,11 +1583,7 @@ button { margin-left: 10px; }
16211583
16221584
### 删除不必要的函数依赖项 {/*removing-unnecessary-function-dependencies*/}
16231585
1624-
<<<<<<< HEAD
1625-
如果你的 Effect 依赖于在渲染期间创建的对象或函数,则它可能会频繁运行。例如,此 Effect 在每次渲染后重新连接,因为 `createOptions` 函数 [在每次渲染时都不同](/learn/removing-effect-dependencies#does-some-reactive-value-change-unintentionally):
1626-
=======
1627-
If your Effect depends on an object or a function created during rendering, it might run too often. For example, this Effect re-connects after every commit because the `createOptions` function is [different for every render:](/learn/removing-effect-dependencies#does-some-reactive-value-change-unintentionally)
1628-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
1586+
如果你的 Effect 依赖于在渲染期间创建的对象或函数,则它可能会频繁运行。例如,此 Effect 在每次提交后重新连接,因为 `createOptions` 函数 [在每次渲染时都不同](/learn/removing-effect-dependencies#does-some-reactive-value-change-unintentionally):
16291587
16301588
```js {4-9,12,16}
16311589
function ChatRoom({ roomId }) {
@@ -1643,19 +1601,11 @@ function ChatRoom({ roomId }) {
16431601
const connection = createConnection();
16441602
connection.connect();
16451603
return () => connection.disconnect();
1646-
<<<<<<< HEAD
1647-
}, [createOptions]); // 🚩 因此,此依赖项在每次重新渲染都是不同的
1604+
}, [createOptions]); // 🚩 因此,此依赖项在每次提交时都是不同的
16481605
// ...
16491606
```
16501607
16511608
就其本身而言,在每次重新渲染时从头新建一个函数不是问题。你不需要优化它。但是,如果你将其用作 Effect 的依赖项,则会导致 Effect 在每次重新渲染后重新运行。
1652-
=======
1653-
}, [createOptions]); // 🚩 As a result, these dependencies are always different on a commit
1654-
// ...
1655-
```
1656-
1657-
By itself, creating a function from scratch on every re-render is not a problem. You don't need to optimize that. However, if you use it as a dependency of your Effect, it will cause your Effect to re-run after every commit.
1658-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
16591609
16601610
避免使用在渲染期间创建的函数作为依赖项,请在 Effect 内部声明它:
16611611
@@ -1825,11 +1775,7 @@ function MyComponent() {
18251775
```js {3}
18261776
useEffect(() => {
18271777
// ...
1828-
<<<<<<< HEAD
1829-
}); // 🚩 没有依赖项数组:每次重新渲染后重新运行!
1830-
=======
1831-
}); // 🚩 No dependency array: re-runs after every commit!
1832-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
1778+
}); // 🚩 没有依赖项数组:每次提交后重新运行!
18331779
```
18341780
18351781
如果你已经指定了依赖项数组,你的 Effect 仍循环地重新运行,那是因为你的某个依赖项在每次重新渲染时都是不同的。

src/content/reference/react/useLayoutEffect.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,9 @@ function Tooltip() {
4747
4848
#### 参数 {/*parameters*/}
4949
50-
<<<<<<< HEAD
51-
* `setup`:处理副作用的函数。setup 函数选择性返回一个*清理*(cleanup)函数。在将组件首次添加到 DOM 之前,React 将运行 setup 函数。在每次因为依赖项变更而重新渲染后,React 将首先使用旧值运行 cleanup 函数(如果你提供了该函数),然后使用新值运行 setup 函数。在组件从 DOM 中移除之前,React 将最后一次运行 cleanup 函数。
50+
* `setup`:处理副作用的函数。setup 函数选择性返回一个*清理*(cleanup)函数。在 [组件提交](/learn/render-and-commit#step-3-react-commits-changes-to-the-dom) 之前,React 会运行 setup 函数。在每次因为提交导致依赖项变更后,React 将首先使用旧值运行 cleanup 函数(如果你提供了该函数),然后使用新值运行 setup 函数。在组件从 DOM 中移除之前,React 将最后一次运行 cleanup 函数。
5251
53-
* **可选** `dependencies``setup` 代码中引用的所有响应式值的列表。响应式值包括 props、state 以及所有直接在组件内部声明的变量和函数。如果你的代码检查工具 [配置了 React](/learn/editor-setup#linting),那么它将验证每个响应式值都被正确地指定为一个依赖项。依赖项列表必须具有固定数量的项,并且必须像 `[dep1, dep2, dep3]` 这样内联编写。React 将使用 [`Object.is`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/is) 来比较每个依赖项和它先前的值。如果省略此参数,则在每次重新渲染组件之后,将重新运行副作用函数。
54-
=======
55-
* `setup`: The function with your Effect's logic. Your setup function may also optionally return a *cleanup* function. Before your [component commits](/learn/render-and-commit#step-3-react-commits-changes-to-the-dom), React will run your setup function. After every commit with changed dependencies, React will first run the cleanup function (if you provided it) with the old values, and then run your setup function with the new values. Before your component is removed from the DOM, React will run your cleanup function.
56-
57-
* **optional** `dependencies`: The list of all reactive values referenced inside of the `setup` code. Reactive values include props, state, and all the variables and functions declared directly inside your component body. If your linter is [configured for React](/learn/editor-setup#linting), it will verify that every reactive value is correctly specified as a dependency. The list of dependencies must have a constant number of items and be written inline like `[dep1, dep2, dep3]`. React will compare each dependency with its previous value using the [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) comparison. If you omit this argument, your Effect will re-run after every commit of the component.
58-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
52+
* **可选** `dependencies``setup` 代码中引用的所有响应式值的列表。响应式值包括 props、state 以及所有直接在组件内部声明的变量和函数。如果你的代码检查工具 [配置了 React](/learn/editor-setup#linting),那么它将验证每个响应式值都被正确地指定为一个依赖项。依赖项列表必须具有固定数量的项,并且必须像 `[dep1, dep2, dep3]` 这样内联编写。React 将使用 [`Object.is`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/is) 来比较每个依赖项和它先前的值。如果省略此参数,则在每次组件提交之后,会重新运行副作用函数。
5953
6054
#### 返回值 {/*returns*/}
6155

src/content/versions.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,8 @@ React 文档位于 [react.dev](https://react.dev),提供最新版本 React 的
5252
- [React Compiler Case Studies](https://www.youtube.com/watch?v=lvhPq5chokM)
5353
- [React 19 Deep Dive: Coordinating HTML](https://www.youtube.com/watch?v=IBBN-s77YSI)
5454

55-
<<<<<<< HEAD
5655
**发布版本**
57-
=======
58-
**Releases**
5956
- [v19.2.1 (December, 2025)](https://github.com/facebook/react/blob/main/CHANGELOG.md#1922-dec-11-2025)
60-
>>>>>>> 2da4f7fbd90ddc09835c9f85d61fd5644a271abc
6157
- [v19.2.1 (December, 2025)](https://github.com/facebook/react/blob/main/CHANGELOG.md#1921-dec-3-2025)
6258
- [v19.2.0 (October, 2025)](https://github.com/facebook/react/blob/main/CHANGELOG.md#1920-october-1st-2025)
6359
- [v19.1.3 (December, 2025)](https://github.com/facebook/react/blob/main/CHANGELOG.md#1913-dec-11-2025)

0 commit comments

Comments
 (0)