Skip to content

Commit

Permalink
Update faq-state.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbbx committed Apr 4, 2019
1 parent dc82a02 commit cdf6b7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/docs/faq-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ category: FAQ

在 React 中,`this.props``this.state` 都代表着*已经被渲染了的*值,即当前屏幕上显示的值。

调用 `setState` 其实是异步的 —— 不要指望在调用 `setState` 之后,`this.state` 会立即反射为新的值。如果你需要基于当前的 state 来计算出新的值,那你应该传递一个函数,而不是一个对象(详情见下文)。
调用 `setState` 其实是异步的 —— 不要指望在调用 `setState` 之后,`this.state` 会立即映射为新的值。如果你需要基于当前的 state 来计算出新的值,那你应该传递一个函数,而不是一个对象(详情见下文)。

代码*不会*像预期那样运行的示例:

Expand Down

0 comments on commit cdf6b7b

Please sign in to comment.