我只是开始使用normalizr来管理我的状态。我已经到达以下代码更新所需对象的地步,但我无法以干净,干燥的方式将它们合并回规范化状态。这样做的首选方式是什么?
请原谅我的傻瓜,谢谢您的宝贵时间。
// normalized state
{
"entities": {
"items": {
"1": {
"id": 1,
"title": "Item 1",
},
"2": {
"id": 2,
"title": "Item 2",
},
"3": {
"id": 3,
"title": "Item 3",
},
},
"groups": {
"20": {
"id": 20,
"title": "Group 1",
"items": [ 1, 2 ]
},
"21": {
"id": 21,
"title": "Group 2",
"items": [ 3 ]
}
}
},
"result": [ 20, 21 ]
}
// actions
export const addItem = values => ({
type: …Run Code Online (Sandbox Code Playgroud)