I have following code:
const initialState = {
searchItems: ['Item'],
}
export default (state = initialState, action) => {
switch (action.type) {
case BACKSPACE_REMOVE_SEARCH_ITEM:
console.log(state.searchItems);
return {
...state,
searchItems: [...state.searchItems.splice(-1)],
};
default:
return state;
}
}
but when I try to execute such an action I receive same array as before with 'Item' inside, it doesn't' remove it. Where is a problem?