【发布时间】:2021-05-05 21:18:23
【问题描述】:
我无法使用 React-easy-state 通过一个函数改变超过 1 个状态
我在下面的示例中使用了batch,并且还单独使用了突变。但是,代码不知何故忽略了我的第二个状态。
一段代码如下所示:
batch(() => {
// batch is used to test out whether it will trigger both store changes.
store.counter = store.counter + 1;
store.sumNum = 10; // this is never updated/mutated.
});
用于将link 复制到沙盒。
【问题讨论】:
标签: reactjs react-state-management react-easy-state