我正在尝试制作一个简单的论坛窗口小部件,我需要获取评论以获取他们的孩子,我想要做的是添加当我在特定位置请求孩子进入减速器时获得的新数组。我已经尝试了很多事情,但是我似乎无法使其正常工作,这是我的减速器:
export default function content(state = {}, action) {
switch (action.type) {
case CONTENT_FETCH_REQUESTED:
return {...state, loading: true};
case CONTENT_FETCH_SUCCEEDED:
return {...state, saving: false, content: action.content};
case CHILDREN_FETCH_SUCCEEDED:
return {
...state,
content: [...state.content[action.index], ...state.content[action.index].children, action.content]
};
default:
return state;
}
}