首页 > 解决方案 > React-redux with immer 在调度中检测到状态突变,在路径中

问题描述

我对反应很陌生,所以这里可能有些愚蠢。我正在使用 immer 来生成下一个状态,但是在尝试初始化操作时出现此错误

function updateCondition(state,action) {
  
  const nextState = produce(state, draftState => {
    draftState.rules[action.ruleIndex].conditions[action.conditionIndex][0] = action.value;
    draftState.rules[action.ruleIndex].conditions[action.conditionIndex][0].ops = {
      displayName: -1, 
      type : "none"
    }

  });
  return nextState;
}

标签: reactjsreduximmer.js

解决方案


推荐阅读