我有一个在Redux中的状态,目前呈现如下:
点击后:
我想要完全删除键1(通常是[action.id])。
目前在reducer中的情况有:
错误的部分是:
你能帮我吗?谢谢!
点击之前:
{0: {
open: false,
negation: false,
close: false
},
1: {
open: false,
negation: false,
close: false,
bool: "and"
}
}
点击后:
{0: {
open: false,
negation: false,
close: false
},
1: {}
}
我想要完全删除键1(通常是[action.id])。
目前在reducer中的情况有:
case 'HANDLE_INCREASE_CHANGE':
return {
...state,
index: state.index + 1,
[state.index + 1]: {
open:false,
negation: false,
close: false,
bool: 'and'
}
}
case 'HANDLE_DECREASE_CHANGE':
return {
...state,
index: state.index - 1,
[state.index]: {}
}
错误的部分是:
[state.index]: {}
你能帮我吗?谢谢!