import React, { useContext } from "react"; import "../styles/Product.css"; import ShoppingBasketIcon from "@mui/icons-material/ShoppingCart"; import { Link } from "react-router-dom"; import { Store } from "../Store"; import CheckIcon from "@mui/icons-material/Check"; import ClearIcon from "@mui/icons-material/Clear"; function Product({ product }) { const { state, dispatch: ctxDispatch } = useContext(Store); const addToCartHandler = () => { ctxDispatch({ type: "CART_ADD_ITEM", payload: { ...product, quantity: 1 }, }); }; return (
product

{product.name}

{product.price}ден

{product.countInStock > 0 ? ( Залиха ) : ( Залиха )}
); } export default Product;