import "./CartPage.css"; import { CartButton } from "./ProductPaga"; import { useContext, useEffect, useState } from "react"; import CartContext from "../ContextApi/CartContext"; const CartPage = () => { const { productList } = useContext(CartContext); function getTotalPrice() { let totalPrice = 0; for (let i = 0; i < productList.length; i++) { totalPrice += parseInt(productList[i].price); } return totalPrice; } return (
Subtotal ({productList.length} items):$ {getTotalPrice()}
Subtotal ({productList.length} items):$ {getTotalPrice()}
{name}
in {status} Eligible for FREE Shipping Colour : Midnight Blue Size: 4GB + 64GB