'have a success message on the top when the product is successfully liked or have green border when the like button is successfully clicked
const likeHandler = async product => {
const response = await apiRequestService.post(
`${process.env.REACT_APP_SERVICE_URL}${process.env.REACT_APP_LIKE}`,
{productId: product._id}
);
console.log(response);<div className="product-wrap mb-25 scroll-zoom">
<div className="product-img">
<a href="product-details.html">
<img className="default-img" src={product.picture} alt="" />
<img className="hover-img" src={product.picture} alt="" />
</a>
<span className="pink">{discount}</span>
<div className="product-action">
<div className="pro-same-action pro-wishlist">
<span title="Wishlist" href={void(0)}
onClick={(e) => {
e.preventDefault();
likeHandler(product);
}
}>
<i className="pe-7s-like"></i>
</span>
</div>
details: when the like button is clicked there suppose to be a border that targets the product wrap. its a props function
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
