javascript - 如何更新和删除 redux state reducer
问题描述
当我移动用户时,我想更新新组,reducer 并删除旧组中的用户
/mystate
// groups: [
// {
// users: [
// '1A',
// '1B'
// ],
// id: '2',
// name: 'shoes'
// },
// {
// users: [],
// id: '1',
// name: 't-shirt'
// }
// ]
我的减速器显示了这一点,我不知道如何更新数据组
//in action get id groups and group with id users
// {
// type: 'UPDATE_GROUP',
// id: '1A',
// group: [
// '1'
// ]
// }
switch (action.type) {
case UPDATE_GROUP:
return {
...state,
shop: {
...state.shop,
groups: state.shop.groups ????
}
};
default:
return state;
}
}```
解决方案
推荐阅读
- django - 未找到带有参数 '('',)' 的 'like_majstor' 的反向操作。尝试了 1 种模式:['likeProfile/(?P
[0-9]+)$'] 问题 - graphics - 将 Layered.jl 画布显示为新窗口
- apache-spark - 火花镶木地板分区,删除分区列
- javascript - 动态添加脚本标签并执行 $(document).ready,无需使用 iframe 或 document.write
- numpy - 偏移旋转矩阵
- react-native - 开玩笑的配置在更新到 26.x 后抛出“type ErrorHandler = (error: mixed, isFatal: boolean) => void”
- python - 如何使用 python 库 mega.py 1.0.8 将文件上传到大型存储平台中的子文件夹?
- excel - 文本文件上的 Excel Office 365 连接字符串
- drupal - 在 Drupal 7 的弹出窗口中禁用登录
- c# - 对象类型“SocketModelLib.Pri_User”没有程序集 ID