React remove item from cart

once i open the cart the product is deleted and this error appears
const handleCartDelete = (product, size) => {
    const updatedCart = cartItems.filter(
      (item) => item.id !== product.id || item.size !== size
    );
    setCartItems(updatedCart);
  };
return (
    <Context.Provider
      value={{
        totalQuantity,
        setTotalQuantity,
        cartItems,
        handleIncrease,
        handleDecrease,
        handleCartDelete,
        setCartItems: (v) => {
          setCartItems(v);
          setTotalQuantity(getTotalQuantity(v));
        },
      }}
    >
      {children}
    </Context.Provider>
  );
};

export default function useCart() {
  return useContext(Context);
}

this is the customhook i have
image.png
image.png
image.png
Was this page helpful?