Next.js Discord

Discord Forum

Onclick events not working in preview environment

Unanswered
Giant panda posted this in #help-forum
Open in Discord
Giant pandaOP
https://cms-8zxjxmwbn-alymkarimgs-projects.vercel.app/products/wo9ah

see
      <div className={styles.container}>
        <div className={styles.image}>
          <Image
            loading="lazy"
            fetchPriority="high"
            src={product.featuredImage.url}
            alt={product.featuredImage.altText}
            fill={true}
          />
        </div>
        <div className={styles.content}>
          <span>
            <h2>{product.title}</h2>
            <h3>{product.priceRange.minVariantPrice.amount}</h3>
          </span>
          <button className={styles.cartbtn} onClick={handleAddToCart}>
            {quantity >= 1 ? `Add more (${quantity})` : 'Add to cart'}
          </button>
        </div>
      </div>
    </>
  )


the site is statically generated, but i would still expect the onclick handlers to work, please let me know if im doing something wrong

1 Reply