47 sessions · mobile-heavy · $2,300 est. lost/mo
What's happening
The click handler binds before the page hydrates, so the first taps do nothing.
The fix
// bind after hydration, not on script load
useEffect(() => {
btn.addEventListener('click', addToCart);
}, []);
✓ Resolved · verified live