zl程序教程

您现在的位置是:首页 >  前端

当前栏目

[React] Pass a function to setState in React

React to in Function pass setState
2023-09-14 09:00:50 时间

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.