title: why my reducer won't update the state ? -Redux
body: <p>i'm trying to remove an item from array with filter method. i see <code>ItemRemoved</code> in Redux Dev Tools but nothing happen in state.
  Why is this happening?
  i will really appreciate some help. this is driving me crazy</p>
  <pre class="lang-js prettyprint-override"><code>import { createSlice, createAction } from &quot;@reduxjs/toolkit&quot;;
  // Action Creater
  const slice = createSlice({
    name: &quot;shoppingCart&quot;,
    initialState: [],
    reducers: {
      itemAdded: some code // ,
      itemRemoved: (cart, { payload }) =&gt; {
        cart.forEach((item) =&gt; {
          if (item.id === payload.id) {
            if (item.count === 1) {
  
  
              return cart.filter((item) =&gt; item.id !== payload.id);
              // THIS RETURN IS NOT WORKING. 
  
  
            } else {
              const itemIndex = cart.indexOf(item);
              cart[itemIndex].count = cart[itemIndex].count - 1;
              return cart;
            }
          }
        });
      },
    },
  });
  export const { itemAdded, itemRemoved } = slice.actions;
  export default slice.reducer;
  </code></pre>