Answers for "concatenate state with previous state in react redux"

0

concatenate state with previous state in react redux

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;
    }
}
Posted by: Guest on August-23-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language