码迷,mamicode.com
首页 > 其他好文 > 详细

[React] Pass a function to setState in React

时间:2017-12-28 11:54:42      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:hidden   dep   show   form   and   https   object   hang   100%   

In React, when you want to set the state which calculation depends on the current state, using an object can lead to state inconsistency. This is due to the fact that React can batch multiple state changes for performance reasons.

This lesson shows you how using a function in setState can solve that.

 

 

[React] Pass a function to setState in React

标签:hidden   dep   show   form   and   https   object   hang   100%   

原文地址:https://www.cnblogs.com/Answer1215/p/8131677.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!