title: React Native, How to convert nested if else into switch statement?
body: <p>Hye, I'm new to react-redux I'm struggling to convert a nested if else statement into switch statement. Can anyone tell me how to do that? below is my code</p>
  <pre><code>if (action.type === ADD_TO_CART) {
      let addedItem = state.jeans.find((item) =&gt; item.id === action.id);
      let existed_item = state.addedItems.find((item) =&gt; action.id === item.id);
      if (existed_item) {
        addedItem.quantity += 1;
        return {
          ...state.jeans,
          total: state.total + addedItem.price,
        };
      } else {
        addedItem.quantity = 1;
        let newTotal = state.total + addedItem.price;
  
        return {
          ...state,
          addedItems: [...state.addedItems, addedItem],
          total: newTotal,
        };
      }
    }
  </code></pre>