📜  在 react redux 中将状态与先前的状态连接起来 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:14.838000             🧑  作者: Mango

代码示例1
const Initial_State = { images: [] };

export default (state = Initial_State, action) => {

    switch (action.type) {

        case 'ImagesFetch':

            return {
                ...state,
                images: [...state.images, action.payload]
            };

        default:
            return state;
    }
}