I am using ES6 spread operator in my react-redux app like this way
var defaultState = {val:1, items:[]};
export default function(state=defaultState, action){
switch(action.type){
case 'ADD_BOOK':
state.val = 0;
return {
...state,
items:action.payload.data.result
};
The problem is each time I get fresh data from action.payload.data.result
assigned to items. I want to have concatenated data from previous state. Can someone help.