Skip to content

Commit

Permalink
Improve translation (#1656)
Browse files Browse the repository at this point in the history
  • Loading branch information
loveloki authored Jan 24, 2025
2 parents 6191dc7 + c0ff479 commit 1346190
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/content/learn/thinking-in-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ function SearchBar({ filterText, inStockOnly }) {
## 步骤五:添加反向数据流 {/*step-5-add-inverse-data-flow*/}
目前你的应用程序可以带着 props 和 state 随着层级结构进行正确渲染。但是根据用户的输入改变 state,需要通过其它的方式支持数据流:深层结构的表单组件需要在 `FilterableProductTable` 中更新 state。
目前你的应用程序可以带着 props 和 state 随着层级结构进行渲染。但是为了支持通过用户输入来改变 state,你需要让数据反向传输:深层结构的表单组件需要更新 `FilterableProductTable` state。
React 使数据流显式展示,是与双向数据绑定相比,需要更多的输入。如果你尝试在上述的例子中输入或者勾选复选框,发现 React 忽视了你的输入。这点是有意为之的。通过 `<input value={filterText} />`,已经设置了 `input``value` 属性,使之恒等于从 `FilterableProductTable` 传递的 `filterText` state。只要 `filterText` state 不设置,(输入框的)输入就不会改变。
Expand Down
2 changes: 1 addition & 1 deletion src/content/learn/tutorial-tic-tac-toe.md
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ export default function Board() {
}
```
`handleClick` 函数使用 JavaScript 数组的 `slice()` 方法创建 `squares` 数组`nextSquares`的副本。然后,`handleClick` 更新 `nextSquares` 数组,将 `X` 添加到第一个(`[0]` 索引)方块。
`handleClick` 函数使用 JavaScript 数组的 `slice()` 方法创建 `squares` 数组的副本`nextSquares`)。然后,`handleClick` 更新 `nextSquares` 数组,将 `X` 添加到第一个(`[0]` 索引)方块。
调用 `setSquares` 函数让 React 知道组件的 state 已经改变。这将触发使用 `squares` state 的组件(`Board`)及其子组件(构成棋盘的 `Square` 组件)的重新渲染。
Expand Down

0 comments on commit 1346190

Please sign in to comment.