From 27ca1166a6297f1bf2eb690ee5460deb9e5d8fbd Mon Sep 17 00:00:00 2001 From: Xleine Date: Tue, 1 Oct 2024 09:05:23 +0000 Subject: [PATCH] fix merge conflict --- .../learn/synchronizing-with-effects.md | 4 --- src/content/learn/thinking-in-react.md | 10 +------ src/content/learn/tutorial-tic-tac-toe.md | 6 +--- .../learn/updating-objects-in-state.md | 4 --- .../reference/react-dom/preinitModule.md | 9 ------ .../server/renderToPipeableStream.md | 15 ---------- src/content/reference/react/useMemo.md | 30 ++++++++----------- src/content/reference/react/useReducer.md | 7 +---- src/content/reference/react/useState.md | 8 ++--- src/content/reference/react/useTransition.md | 8 ++--- .../components-and-hooks-must-be-pure.md | 6 +--- yarn.lock | 5 ---- 12 files changed, 21 insertions(+), 91 deletions(-) diff --git a/src/content/learn/synchronizing-with-effects.md b/src/content/learn/synchronizing-with-effects.md index 94ccc64e98..c959e27752 100644 --- a/src/content/learn/synchronizing-with-effects.md +++ b/src/content/learn/synchronizing-with-effects.md @@ -627,11 +627,7 @@ React 有意在开发环境下重新挂载你的组件,来找到类似上例 ### 管理非 React 小部件 {/*controlling-non-react-widgets*/} -<<<<<<< HEAD 有时你需要添加不是用 React 实现的 UI 小部件。比如说你想在你的页面添加一个地图组件。它有一个 `setZoomLevel()` 方法,然后你希望地图的缩放比例和代码中的 `zoomLevel` state 保持同步。你的 Effect 应该类似于: -======= -Sometimes you need to add UI widgets that aren't written in React. For example, let's say you're adding a map component to your page. It has a `setZoomLevel()` method, and you'd like to keep the zoom level in sync with a `zoomLevel` state variable in your React code. Your Effect would look similar to this: ->>>>>>> 589a1d3a8182d851718840f91bec80b0a13e2495 ```js useEffect(() => { diff --git a/src/content/learn/thinking-in-react.md b/src/content/learn/thinking-in-react.md index f5442a5d4e..2f2699a813 100644 --- a/src/content/learn/thinking-in-react.md +++ b/src/content/learn/thinking-in-react.md @@ -270,19 +270,11 @@ props 和 state 是不同的,但它们可以共同工作。父组件将经常 现在为这个 state 贯彻我们的策略: -<<<<<<< HEAD 1. **验证使用 state 的组件**: * `ProductTable` 需要基于 state (搜索文本和复选框值) 过滤产品列表。 * `SearchBar` 需要展示 state (搜索文本和复选框值)。 2. **寻找它们的父组件**:它们的第一个共同父组件为 `FilterableProductTable`。 -3. **决定 state 放置的地方**:我们将放置过滤文本和勾选 state 的值于 `FilterableProductTable`。 -======= -1. **Identify components that use state:** - * `ProductTable` needs to filter the product list based on that state (search text and checkbox value). - * `SearchBar` needs to display that state (search text and checkbox value). -2. **Find their common parent:** The first parent component both components share is `FilterableProductTable`. -3. **Decide where the state lives**: We'll keep the filter text and checked state values in `FilterableProductTable`. ->>>>>>> 589a1d3a8182d851718840f91bec80b0a13e2495 +3. **决定 state 放置的地方**:我们将过滤文本和勾选 state 的值放置于 `FilterableProductTable` 中。 所以 state 将被放置在 `FilterableProductTable`。 diff --git a/src/content/learn/tutorial-tic-tac-toe.md b/src/content/learn/tutorial-tic-tac-toe.md index 0c499ac6a8..c7c9de4eb4 100644 --- a/src/content/learn/tutorial-tic-tac-toe.md +++ b/src/content/learn/tutorial-tic-tac-toe.md @@ -1133,11 +1133,7 @@ export default function Board() { -<<<<<<< HEAD -JavaScript 支持闭包,这意味着内部函数(例如 `handleClick`)可以访问外部函数(例如 `Board`)中定义的变量和函数。`handleClick` 函数可以读取 `squares` state 并调用 `setSquares` 方法,因为它们都是在 `Board` 函数内部定义的。 -======= -JavaScript supports [closures](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures) which means an inner function (e.g. `handleClick`) has access to variables and functions defined in an outer function (e.g. `Board`). The `handleClick` function can read the `squares` state and call the `setSquares` method because they are both defined inside of the `Board` function. ->>>>>>> 589a1d3a8182d851718840f91bec80b0a13e2495 +JavaScript 支持 [闭包](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Closures),这意味着内部函数(例如 `handleClick`)可以访问外部函数(例如 `Board`)中定义的变量和函数。`handleClick` 函数可以读取 `squares` state 并调用 `setSquares` 方法,因为它们都是在 `Board` 函数内部定义的。 diff --git a/src/content/learn/updating-objects-in-state.md b/src/content/learn/updating-objects-in-state.md index 51ce4a775c..42059584fd 100644 --- a/src/content/learn/updating-objects-in-state.md +++ b/src/content/learn/updating-objects-in-state.md @@ -383,11 +383,7 @@ input { margin-left: 5px; margin-bottom: 5px; } #### 使用一个事件处理函数来更新多个字段 {/*using-a-single-event-handler-for-multiple-fields*/} -<<<<<<< HEAD 你也可以在对象的定义中使用 `[` 和 `]` 括号来实现属性的动态命名。下面是同一个例子,但它使用了一个事件处理函数而不是三个: -======= -You can also use the `[` and `]` braces inside your object definition to specify a property with a dynamic name. Here is the same example, but with a single event handler instead of three different ones: ->>>>>>> 589a1d3a8182d851718840f91bec80b0a13e2495 diff --git a/src/content/reference/react-dom/preinitModule.md b/src/content/reference/react-dom/preinitModule.md index 157d878d48..e2e35bf147 100644 --- a/src/content/reference/react-dom/preinitModule.md +++ b/src/content/reference/react-dom/preinitModule.md @@ -51,21 +51,12 @@ function AppRoot() { #### 参数 {/*parameters*/} -<<<<<<< HEAD * `href`:字符串,要下载并执行的模块的 URL。 * `options`:对象,可以包含以下属性: * `as`:必需的字符串,只能是 `script`。 * `crossOrigin`:字符串,表示要使用的 [CORS 策略](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Attributes/crossorigin),可能的值为 `anonymous` 与 `use-credentials`。 * `integrity`:字符串,为资源的加密哈希,用于 [验证其真实性](https://developer.mozilla.org/zh-CN/docs/Web/Security/Subresource_Integrity)。 * `nonce`:字符串,表示使用严格内容安全策略时允许资源的 [加密随机数](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Global_attributes/nonce)。 -======= -* `href`: a string. The URL of the module you want to download and execute. -* `options`: an object. It contains the following properties: - * `as`: a required string. It must be `'script'`. - * `crossOrigin`: a string. The [CORS policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) to use. Its possible values are `anonymous` and `use-credentials`. - * `integrity`: a string. A cryptographic hash of the module, to [verify its authenticity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity). - * `nonce`: a string. A cryptographic [nonce to allow the module](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) when using a strict Content Security Policy. ->>>>>>> 589a1d3a8182d851718840f91bec80b0a13e2495 #### 返回值 {/*returns*/} diff --git a/src/content/reference/react-dom/server/renderToPipeableStream.md b/src/content/reference/react-dom/server/renderToPipeableStream.md index 770cac65b3..a40c0892e3 100644 --- a/src/content/reference/react-dom/server/renderToPipeableStream.md +++ b/src/content/reference/react-dom/server/renderToPipeableStream.md @@ -48,7 +48,6 @@ const { pipe } = renderToPipeableStream(, { * `reactNode`:想要将其渲染为 HTML 的 React 节点,比如像 `` 这样的 JSX 元素。这样做意味着整个页面文档都将被渲染,所以这里提到的 `App` 组件将渲染 `` 标签. -<<<<<<< HEAD * **可选** `options`:用于配置流的对象. * **可选** `bootstrapScriptContent`:指定一个字符串,这个字符串将被放入 `