This function is responsible for updating the item quantity , first fetching the localStorage , then if the item exists update its quantity, and update the localStorage as well.The thing i don't understand here as exist is a different object , and i am updating its quantity ,why the cart gets updated with new quantity
const increaseQty = (id: number) => {
        const cart9 = getCartFromLocalStorage();
        const exist = cart9.find((item: any) => item.id === id);
        if (exist) {
          exist.quantity += 1;
          console.log({ exist, cart9 });
    
          localStorage.setItem("cart", JSON.stringify(cart9));
          getCartFromLocalStorage();
        }
      };
