我想在react redux中推入第N个数组项。但它不推也不给予任何错误。
在函数中我尝试喜欢这个
const id = action.payload.container_id;
console.log("id", id);
// state.containers
let key = 0;
state.containers = state.containers.map((cont) => {
console.log("key", key);
if (cont.info.id === id) {
console.log("found container atrr", state.containers[key].info.title);
state.containers[key].info.attributes.push({
id: action.payload.container_attr_id,
value: action.payload.data.value,
name: action.payload.data.name,
});
}
key = key + 1;
});
1条答案
按热度按时间tjjdgumg1#
我发现了我的错误。需要返回