push object in array react reducer code example
Example: how to push an object into an array in reducer
case ADD_CATEGORY_SUCCESS:
return { ...state,categories:[...state.categories,action.payload] ,loading: true };
case ADD_CATEGORY_SUCCESS:
return { ...state,categories:[...state.categories,action.payload] ,loading: true };