I have this code here:
const favouriteMovies = (state = initialState, action) => {
switch(action.type) {
case 'setMovieToFavourites': return {
...state,
hearted: [...state.hearted, action.movie]
}
default: return state;
}
}
const unlikeMovie = (state = initialState, action) => {
switch(action.type) {
case 'unlikeMovie': return {
...state,
hearted: state.hearted.filter(item => item !== action.movie),
}
default: return state;
}
}
So the first function favouriteMovies adds movies to array and with the second function I want to remove the movie from the hearted movies. In the unlikeMovie function I get the movieID which equals to the one of the liked movies but it won't remove the movie from the hearted state. Why it isn't removing ?
movieonly have value of movie id.