Skip to content

Commit 70ae525

Browse files
fix conflicts
1 parent 71cc12a commit 70ae525

File tree

4 files changed

+2
-37
lines changed

4 files changed

+2
-37
lines changed

src/content/reference/react-dom/client/createRoot.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,10 @@ root.render(<App />);
4545
4646
* **可选** `options`:用于配置这个 React 根节点的对象。
4747
48-
<<<<<<< HEAD
49-
* **可选** `onRecoverableError`:回调函数,在 React 从异常错误中恢复时自动调用。
50-
* **可选** `identifierPrefix`:一个 React 用来配合 [`useId`](/reference/react/useId) 生成 id 的字符串前缀。在同一个页面上使用多个根节点的场景下,这将能有效避免冲突。
51-
=======
5248
* <CanaryBadge title="This feature is only available in the Canary channel" /> **optional** `onCaughtError`: Callback called when React catches an error in an Error Boundary. Called with the `error` caught by the Error Boundary, and an `errorInfo` object containing the `componentStack`.
5349
* <CanaryBadge title="This feature is only available in the Canary channel" /> **optional** `onUncaughtError`: Callback called when an error is thrown and not caught by an Error Boundary. Called with the `error` that was thrown, and an `errorInfo` object containing the `componentStack`.
5450
* **optional** `onRecoverableError`: Callback called when React automatically recovers from errors. Called with an `error` React throws, and an `errorInfo` object containing the `componentStack`. Some recoverable errors may include the original error cause as `error.cause`.
5551
* **optional** `identifierPrefix`: A string prefix React uses for IDs generated by [`useId`.](/reference/react/useId) Useful to avoid conflicts when using multiple roots on the same page.
56-
>>>>>>> 07cbd001f936c22f731e5741e9853ffcdfb3fedd
5752
5853
#### 返回值 {/*returns*/}
5954
@@ -1159,9 +1154,6 @@ root.render(<App />);
11591154
11601155
---
11611156
1162-
<<<<<<< HEAD
1163-
### 我得到了一个异常报错信息:“目标容器不是一个 DOM 元素(Target container is not a DOM element)” {/*im-getting-an-error-target-container-is-not-a-dom-element*/}
1164-
=======
11651157
### I'm getting an error: "You passed a second argument to root.render" {/*im-getting-an-error-you-passed-a-second-argument-to-root-render*/}
11661158
11671159
A common mistake is to pass the options for `createRoot` to `root.render(...)`:
@@ -1185,7 +1177,6 @@ root.render(<App />);
11851177
---
11861178
11871179
### I'm getting an error: "Target container is not a DOM element" {/*im-getting-an-error-target-container-is-not-a-dom-element*/}
1188-
>>>>>>> 07cbd001f936c22f731e5741e9853ffcdfb3fedd
11891180
11901181
这个异常错误即字面意思,你传递给 `createRoot` 的内容不是一个 DOM 元素。
11911182

src/content/reference/react-dom/client/hydrateRoot.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,10 @@ React 将会连接到内部有 `domNode` 的 HTML 上,然后接管其中的 `d
4343
4444
* **可选** `options`:一个包含此 React 根元素选项的对象。
4545
46-
<<<<<<< HEAD
47-
* **可选** `onRecoverableError`:当 React 自动从错误中恢复时调用的回调函数。
48-
* **可选** `identifierPrefix`:字符串前缀,用于标识由 [`useId`](/reference/react/useId) 生成的 ID ,可以避免在同一页面上使用多个 React 根元素时出现冲突。必须与服务端使用的前缀相同。
49-
=======
5046
* <CanaryBadge title="This feature is only available in the Canary channel" /> **optional** `onCaughtError`: Callback called when React catches an error in an Error Boundary. Called with the `error` caught by the Error Boundary, and an `errorInfo` object containing the `componentStack`.
5147
* <CanaryBadge title="This feature is only available in the Canary channel" /> **optional** `onUncaughtError`: Callback called when an error is thrown and not caught by an Error Boundary. Called with the `error` that was thrown and an `errorInfo` object containing the `componentStack`.
5248
* **optional** `onRecoverableError`: Callback called when React automatically recovers from errors. Called with the `error` React throws, and an `errorInfo` object containing the `componentStack`. Some recoverable errors may include the original error cause as `error.cause`.
5349
* **optional** `identifierPrefix`: A string prefix React uses for IDs generated by [`useId`.](/reference/react/useId) Useful to avoid conflicts when using multiple roots on the same page. Must be the same prefix as used on the server.
54-
>>>>>>> 07cbd001f936c22f731e5741e9853ffcdfb3fedd
5550
5651
5752
#### 返回值 {/*returns*/}
@@ -379,9 +374,6 @@ export default function App({counter}) {
379374
380375
</Sandpack>
381376
382-
<<<<<<< HEAD
383-
在 hydrate 过的根组件上调用 `root.render` 是不常见的。通常情况下,你可以在组件的内部 [更新 state](/reference/react/useState)。
384-
=======
385377
It is uncommon to call [`root.render`](#root-render) on a hydrated root. Usually, you'll [update state](/reference/react/useState) inside one of the components instead.
386378
387379
### Show a dialog for uncaught errors {/*show-a-dialog-for-uncaught-errors*/}
@@ -1206,4 +1198,3 @@ root.render(App, {onUncaughtError});
12061198
// ✅ Correct: pass options to createRoot.
12071199
const root = hydrateRoot(container, <App />, {onUncaughtError});
12081200
```
1209-
>>>>>>> 07cbd001f936c22f731e5741e9853ffcdfb3fedd

src/content/reference/react/Suspense.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,11 +1741,7 @@ function Router() {
17411741
// ...
17421742
```
17431743
1744-
<<<<<<< HEAD
1745-
这告诉 React 此 state Transition 是不紧急的,最好继续显示上一页,而不是隐藏任何已经显示的内容。现在点击按钮并等待 `Biography` 加载:
1746-
=======
1747-
This tells React that the state transition is not urgent, and it's better to keep showing the previous page instead of hiding any already revealed content. Now clicking the button "waits" for the `Biography` to load:
1748-
>>>>>>> 07cbd001f936c22f731e5741e9853ffcdfb3fedd
1744+
这告诉 React 这个状态转移是不紧急的,最好继续显示上一页,而不是隐藏任何已经显示的内容。现在点击按钮并等待 `Biography` 加载:
17491745
17501746
<Sandpack>
17511747

src/content/reference/react/useDeferredValue.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,37 +36,24 @@ function SearchPage() {
3636

3737
#### 参数 {/*parameters*/}
3838

39-
<<<<<<< HEAD
40-
* `value`:你想延迟的值,可以是任何类型。
41-
=======
42-
* `value`: The value you want to defer. It can have any type.
39+
* `value`: 你想延迟的值,可以是任何类型。
4340
* <CanaryBadge title="This feature is only available in the Canary channel" /> **optional** `initialValue`: A value to use during the initial render of a component. If this option is omitted, `useDeferredValue` will not defer during the initial render, because there's no previous version of `value` that it can render instead.
4441

45-
>>>>>>> 07cbd001f936c22f731e5741e9853ffcdfb3fedd
46-
4742
#### 返回值 {/*returns*/}
4843

49-
<<<<<<< HEAD
50-
在组件的初始渲染期间,返回的延迟值将与你提供的值相同。但是在组件更新时,React 将会先尝试使用旧值进行重新渲染(因此它将返回旧值),然后再在后台使用新值进行另一个重新渲染(这时它将返回更新后的值)。
51-
=======
5244
- `currentValue`: During the initial render, the returned deferred value will be the same as the value you provided. During updates, React will first attempt a re-render with the old value (so it will return the old value), and then try another re-render in the background with the new value (so it will return the updated value).
5345

5446
<Canary>
5547

5648
In the latest React Canary versions, `useDeferredValue` returns the `initialValue` on initial render, and schedules a re-render in the background with the `value` returned.
5749

5850
</Canary>
59-
>>>>>>> 07cbd001f936c22f731e5741e9853ffcdfb3fedd
6051

6152
#### 注意事项 {/*caveats*/}
6253

63-
<<<<<<< HEAD
64-
- 你应该向 `useDeferredValue` 传递原始值(如字符串和数字)或在渲染之外创建的对象。如果你在渲染期间创建了一个新对象,并立即将其传递给 `useDeferredValue`,那么每次渲染时这个对象都会不同,这将导致后台不必要的重新渲染。
65-
=======
6654
- When an update is inside a Transition, `useDeferredValue` always returns the new `value` and does not spawn a deferred render, since the update is already deferred.
6755

6856
- The values you pass to `useDeferredValue` should either be primitive values (like strings and numbers) or objects created outside of rendering. If you create a new object during rendering and immediately pass it to `useDeferredValue`, it will be different on every render, causing unnecessary background re-renders.
69-
>>>>>>> 07cbd001f936c22f731e5741e9853ffcdfb3fedd
7057

7158
-`useDeferredValue` 接收到与之前不同的值(使用 [`Object.is`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/is) 进行比较)时,除了当前渲染(此时它仍然使用旧值),它还会安排一个后台重新渲染。这个后台重新渲染是可以被中断的,如果 `value` 有新的更新,React 会从头开始重新启动后台渲染。举个例子,如果用户在输入框中的输入速度比接收延迟值的图表重新渲染的速度快,那么图表只会在用户停止输入后重新渲染。
7259

0 commit comments

Comments
 (0)