Skip to content

Commit d26db4a

Browse files
committed
Update scaling-up-with-reducer-and-context.md
1 parent 2e14471 commit d26db4a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

beta/src/pages/learn/scaling-up-with-reducer-and-context.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,11 @@ Reducer 有助于保持事件处理程序的简短明了。但随着应用规模
229229
/>
230230
```
231231

232-
在像这样的小示例里这样做没什么问题,但是如果你有成千上百个组件,传递所有状态和函数就会让你非常烦恼
232+
在像这样的小示例里这样做没什么问题,但是如果你有成千上百个组件,传递所有状态和函数可能会非常麻烦
233233

234234
<!--(TODO: illustration of prop drilling)-->
235235

236-
这就是为什么,比起通过 props 传递它们,你可能想把 `tasks` 状态和 `dispatch` 函数都 [放入 context](/learn/passing-data-deeply-with-context)**这样,所有的在 `TaskBoard` 组件树之下的组件都不必一直往下传 props 而可以直接读取 tasks 和 dispatch 函数。**
236+
这就是为什么,比起通过 props 传递它们,你可能会想把 `tasks` 状态和 `dispatch` 函数都 [放入 context](/learn/passing-data-deeply-with-context)**这样,所有的在 `TaskBoard` 组件树之下的组件都不必重复往下传 props 而可以直接读取 tasks 和 dispatch 函数。**
237237

238238
<!--(TODO: illustration of context)-->
239239

@@ -251,10 +251,10 @@ Reducer 有助于保持事件处理程序的简短明了。但随着应用规模
251251
const [tasks, dispatch] = useReducer(tasksReducer, initialTasks);
252252
```
253253

254-
为了将它们从组件树往下传,你将 [创建](/learn/passing-data-deeply-with-context#step-2-use-the-context) 两个不同的 context:
254+
为了将它们从组件树往下传,你将 [创建](/learn/passing-data-deeply-with-context#step-2-use-the-context) 两个独立的 context:
255255

256256
- `TasksContext` 提供当前的 tasks 列表。
257-
- `TasksDispatchContext` 提供了一个函数可以让组件分发动作
257+
- `TasksDispatchContext` 提供了一个函数,以便让组件分发动作
258258

259259
将它们从单独的文件导出,以便以后可以从其他文件导入它们:
260260

@@ -1358,7 +1358,7 @@ ul, li { margin: 0; padding: 0; }
13581358
2. 让组件的 context 使用 reducer。
13591359
3. 使用组件中需要读取的 context。
13601360
- 你可以通过将所有传递信息的代码移动到单个文件中来进一步整理组件。
1361-
- 你可以导出一个像 `TasksProvider` 可以提供 context 的组件。
1361+
- 你可以导出一个例如 `TasksProvider` 这样可以提供 context 的组件。
13621362
- 你也可以导出像 `useTasks``useTasksDispatch` 这样的自定义 Hook。
13631363
- 你可以在你的应用程序中大量使用 context 和 reducer 的组合。
13641364

0 commit comments

Comments
 (0)