749 viewsMern Amazona

{product.countInStock === 0 ? (
              <button type=”button” disabled className=”btn btn-light”>
                Out OF Stock
              </button>
            ) : (
              <button
                type=”button”
                onClick={() => addToCartHandler(product)}
                className=”btn btn-warning”
              >
                Add to cart
              </button>
            )}

Bassir Answered question October 13, 2022

use console.log before return to see the value of product.countInStock

is it number and is it 0?

Bassir Answered question October 13, 2022