I'm building my first application with React and Redux. I'm trying to delete an item from an array in my reducer using splice.
Here my state:
favourite: { recipes: [], wines: [], products: [] }
Here my action:
if (action.type === "REMOVE_RECIPE_FROM_FAV") {
let favourite = state.favourite;
favourite.recipes.splice(action.data, 1);
return {
...state,
favourite: favourite,
};
}
When i console.log favourite i can see that I'm deleting the item, but my component doesn't update.
Could you please help me?