Skip to content

Commit

Permalink
Update getting-started.zh-CN.mdx (#98)
Browse files Browse the repository at this point in the history
The origin translation "虽然我们可以避免使用 Context 传递 props" means "Although we can avoid using Context to pass props", which has a diffrence from "Although we can avoid passing props using Context".
  • Loading branch information
Ryan-yang125 authored Jun 9, 2021
1 parent dad5239 commit dba2203
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pages/getting-started.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function Avatar({ user }) {

通常,我们需要将所有的数据请求都保存在顶级组件中,并为树深处的每个组件添加 props。如果我们给页面添加更多的数据依赖,代码将变得更加难以维护。

虽然我们可以避免使用 [Context](https://reactjs.org/docs/context.html) 传递 props,但仍然存在动态内容问题:页面内容中的组件可以是动态的,顶级组件可能不知道其子组件将需要什么数据。
虽然我们可以使用 [Context](https://reactjs.org/docs/context.html) 来避免传递 props,但仍然存在动态内容问题:页面内容中的组件可以是动态的,顶级组件可能不知道其子组件将需要什么数据。

SWR 完美地解决了这个问题。使用我们刚刚创建的 `useUser` hook,可以将代码重构为:

Expand Down

1 comment on commit dba2203

@vercel
Copy link

@vercel vercel bot commented on dba2203 Jun 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

Please sign in to comment.