title: React native add to cart quantity and total price issue
body: <p>Facing an issue where my cart is not updating the quantity and total price correctly after 2 quantities.</p>
  
  <p>Using redux action during my ADD_TO_CART on press button, I will assign a new element into object of quantity:1</p>
  
  <pre><code>export function addToCart(card){
      return (dispatch) =&gt; {
          card.quantity = 1;
          dispatch({type: ADD_TO_CART, data:card});
          console.log(card);
      };
  }
  </code></pre>
  
  <p>On my reducer, here is the function </p>
  
  <pre><code>let cartState = { data: [], totalPrice: 0 };
  const cartReducer = (state = cartState, action) =&gt; {
              switch (action.type) {
                  case ADD_TO_CART:
                  let totalPriceCart = 0;
                  let checkforDuplicate = state.data.some(function (a){
                      if(a.sno === action.data.sno){
                          return true;
                      }
                  });
  
                  if(checkforDuplicate){
                      for (let i in state.data) {
                          if (state.data[i].sno === action.data.sno) {
                              state.data[i].quantity = action.data.quantity+1;
                              break;
                          }
                      }
                      for(let e in state.data){
                          totalPriceCart = totalPriceCart + (state.data[e].price*state.data[e].quantity);
                      }
                      return  {data: state.data, totalPrice: totalPriceCart };
                  }
  
                  let cloneArr = state.data.concat(action.data);
                  for(let i in cloneArr){
                      totalPriceCart = totalPriceCart+(cloneArr[i].price*cloneArr[i].quantity);
                  }
  
                  return {...state, data : cloneArr, totalPrice: totalPriceCart }
                  default:
                  return state;
              }
          };
  </code></pre>
  
  <p>What am I doing here in the reducer is,</p>
  
  <ul>
  <li>If there is a duplicate item from adding to cart action object (detect by sno), will not concat into the main state array but update the quantity of existing item in the state</li>
  <li><p>Else will concat the array</p></li>
  <li><p>At the end, will count the total price of the whole item in state and pass it back to my cart to show the total based on the quantity*price</p></li>
  </ul>
  
  <p>Issue is that, currently, my code only shows until 2x, when adding the same item for 3rd time, the quantity will stay at 2x and the price is not calculating correctly.</p>