Closed darvinsilveira closed 3 years ago
Hey
I'm not too sure about the exact error you're referring to since it works in a fresh install I did just now - as you can see here
Can you share more of your code?
Hi Jamie, you can close the issue, I found out the problem.
I thought I could call CartProvider component only on the parts where I show my cart, but it HAVE to be around the entire application.
Sorry for bothering you with this and thank you so much for the fast reply.
Hi, thanks for the great work.
I'm trying to use methods like addItem, removeItem...and I keep getting addItem is not a function. I followed all the examples and properties like isEmpty or cartTotal are working just fine, but when trying to use a method I get an error. I'm using NextJS. Here a simple example:
`import { CartProvider, useCart } from "react-use-cart";
const ProductDetails = () => {
`
The error:
I've added the addItem inside useEffect for testing purposes.
My page is wrapped by CartProvider also, but I think this is just to keep track of the states.
I don't know if is a bug or what is, so I decide to report this as an issue. Sorry if it's not the case.