0

In a product card div I have an onClick for the whole card that opens up the product page, here I have a Button which adds product to basket, though it functions properly but whenever I click it, it opens the product page too. I want the button action to ignore the div onClick that opens up product page.

<div className="product-card" onClick={clicked}>
          <div className="product-card-image">
            <img
              src={product.imageUrl || placeholder}
              alt={product.name}
            />
    
          </div>
          <div className="product-card__details">
            <h5 className="product-card--name">{product.name}</h5>
    
            <p className="product-card--price"> ₹ {product.price}</p>
    
          </div>
          <div>
            <Button
              className="cartButton"
              type="primary"
              icon={<img src={plusCart} />}
              onClick={addToBasket}
            />
          </div>
        </div>

0 Answers0