Closed japick-joules closed 3 years ago
Next.js version 11.0.1 React version 17.0.2
11.0.1
17.0.2
Code ([handle].tsx):
import { useCart } from "react-use-cart" export default function Product() { const { addItem } = useCart() ... <button onClick={() => addItem({p.id})}>Add to bag</button> }
When clicking the Add to bag button Next throws the following error:
Unhandled Runtime Error TypeError: addItem is not a function
Closing as fixed.
The app wasn't wrapped inside the CartProvider component.
CartProvider
All good now, thanks!
Next.js version
11.0.1
React version17.0.2
Code ([handle].tsx):
When clicking the Add to bag button Next throws the following error: