title: How to add Unique item to array in redux
body: <p>My movie app has a favourite movies page and you can add movies to your favourite page by clicking on the like button on the movie itself, and I don't want to add the same movie over and over i tried this in my redux reducer:</p>
  <pre><code>const initialState = {
   favouriteMovies: []
  }
  
  const favMoviesReducer = (state = initialState, action) =&gt; {
    
    switch (action.type) { 
  
      case actionTypes.GET_FAV_MOVIES:
  
        if (state.favouritesMovies.indexOf(action.favMovie === -1)) {
          return {
            favouritesMovies: [...state.favouritesMovies, action.favMovie],
            // note: action.favMovie is an object 
          };
        }
  
        return state;
  
      default:
        return state;
    }
  };
  </code></pre>
  <p>but it didn't work so any advice please?</p>