因此,从化简文件中,我使用以下默认值初始化状态:
const initialState: IBooksStoreState = new Map<string, IBook>();
然后执行此操作:
export const bookReducer = (state: IBooksStoreState = cloneDeep(initialState), action: Action) => {
switch (action.type) {
case DATA_SUCCESS: {
return {
...state,
books: action.data
};
}
default:
return state;
}
};
但是,当我查看redux商店时,
{“ _ mapData”:[],“ _ objectIndex”:{},“ _ stringIndex”:{},“ _ otherIndex”:{},“ size”:0,“ books”:[...]} >
注意到它在商店中包含“ _mapData”:[],“ _ objectIndex”:{},“ _ stringIndex”:{},“ _ otherIndex”:{}和“ size”:0之类的数据。
很可能来自新的Map(),我该如何解决?谢谢