I have following reducer:
case INIT:
return {
...state,
items: [...state.items, ...action.payload],
};
I need somehow to check if in state.items array are items from action.payload array and do not include them in state.items. I have such a code:
[...state.items.filter(item => item !== action.payload)],
but it doesn't what I need, it doesn't work. Can somebody help me?
state.itemsandaction.payload? Objects or primitive types?[...state.items.filter((item) => item !== action.payload)]what array does your code return for this?