import React, { useEffect, useState } from "react"; import { useProduct } from "vtex.product-context"; import PixImage from "./PixImage"; import Style from "./styles.css"; const PixComponents = () => { const [pixValue, setPixValue] = useState(0); const productInfo = useProduct(); const productLowPrice = productInfo?.product?.priceRange.sellingPrice.lowPrice; useEffect(() => { if (productLowPrice) { setPixValue(productLowPrice * 0.9); } }, []); return (
R$ {pixValue.toFixed(2).replace(".", ",")}
10 % de desconto
); }; export default PixComponents;