import React from 'react' import './CartProducts.css' import StarIcon from '@material-ui/icons/Star'; import StarHalfIcon from '@material-ui/icons/StarHalf'; import { useStateValue } from '../../context/StateProvider'; const CartProducts = ({ id, title, price, rating, image, hideButton }) => { const [{ cart }, dispatch] = useStateValue() let halfRating = (rating - Math.floor(rating)) * 10; const removeFromCart = () => { dispatch({ type: "REMOVE_FROM_CART", payload: id }) } return (

{title}

₹. {price}

{ Array(Math.floor(rating)) .fill() .map((_, index) => ( )) } { (halfRating > 0) ? : <> }
{!hideButton && ()}
) } export default CartProducts