Add property reducer redux

Viewed 4117

I wan't to add a property sections: [] to my object formOpen in the reducer, I receive my object formOpen from my server with other properties and I want to add this one, how can I do that here ? Thanks

import { combineReducers } from 'redux'
import * as types from '../constants/ActionTypes'

const initialState = {
    isFetching: false,
    formOpen: {

    }
};

export function formEditor (state = initialState, action) {
    switch (action.type) {
        case  types.RECEIVE_OPEN_FORM:
            return {
                ...state,
                isFetching: false,
                formOpen: action.formOpen
            };        

        default:
            return state;
    }
}

export default combineReducers({
    formEditor
})
1 Answers
Related