Reactjs 如何在React easy状态中更改多个状态?

Reactjs 如何在React easy状态中更改多个状态?,reactjs,react-state-management,react-easy-state,Reactjs,React State Management,React Easy State,我不能通过一个函数使用 我在下面的例子中使用了批处理,也分别使用了变异。然而,代码忽略了我的第二个状态 这段代码如下所示: 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. });

我不能通过一个函数使用

我在下面的例子中使用了批处理,也分别使用了变异。然而,代码忽略了我的第二个状态

这段代码如下所示:

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.
});

用于复制到沙盒。

您没有任何名为
sumNum
的状态

// your store

const myStore = store({
  rndNum: "",
  counter: 1,
  someNum: 2, <--- not sumNum
  showRes: false 
});
//你的商店
const myStore=store({
rndNum:“”,
柜台:1,,
someNum:2,