Best way to implement a cart?

I've implemented a cart using jotai's atomWithStorage to save the items in lcoalStorage, but I was wondering if I should store the cart in the server instead?
In this specific app only logged in users can access the store. Are there other better ways of implementing a cart?
Was this page helpful?