Reactjs 在调度中检测到状态突变:即使使用toolkit

Reactjs 在调度中检测到状态突变:即使使用toolkit,reactjs,redux,redux-toolkit,Reactjs,Redux,Redux Toolkit,此操作引发以下错误: setTimerState(状态,{payload}:PayloadAction){ 常量{timer,timerState}=有效负载 const timerInStore=state.stepTimers .find(t=>t.timerId==timer.timerId)! TimerStore.state=timerState } 错误:不变量失败:在调度内检测到状态突变,路径为:cookingSession.stepTimers.0.state。看看处理动作{“

此操作引发以下错误:

setTimerState(状态,{payload}:PayloadAction){
常量{timer,timerState}=有效负载
const timerInStore=state.stepTimers
.find(t=>t.timerId==timer.timerId)!
TimerStore.state=timerState
}
错误:不变量失败:在调度内检测到状态突变,路径为:cookingSession.stepTimers.0.state。看看处理动作{“type”:“session/setTimerState”,“payload”:{“timer”:{“label”:“Dance”,“durationSec”:600,“stepIndex”:0,“timerId”:0,“state”:2},“timerState”:2}

我认为Redux工具包允许您进行这种状态更改。
是因为我的步进计时器是类对象而不是POJO吗?

正确。只有基元值、对象和数组被认为是可序列化的,而类实例则不是


根据Redux样式指南,.

正确。只有基元值、对象和数组被认为是可序列化的,而类实例则不是

根据Redux样式指南