我很困惑。
const oldPosts = state.items; // -> [{id: 12, ... }, {id: 13, ... }]
const newPosts = action.posts // -> [{id: 12, ...}];
// what I want to have is [{id: 12, ... }, {id: 13, ... }] / "merged"
const iWantMerged = ...??
所以我的方法就是这样的
const merged = [...newPosts, ...oldPosts];
// -> [{id: 13, ... }, {id: 12, ... }, {id: 13, ... }]
// and then remove the duplicated items.
所以有两个问题: