首页 > 其他 > 详细

[React] Pass a function to setState in React

时间:2017-12-28 10:24:02      阅读:235      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!