Next.js Discord

Discord Forum

What would you recommend for cart management

Answered
Anay-208 posted this in #help-forum
Open in Discord
What would you recommend me to use for managing user caer `
Answered by averydelusionalperson
most people will use localStorage or cookies
View full answer

35 Replies

like state management?
@averydelusionalperson like state management?
sort of, is there any package or should I make it from scratch only
you're using next.js right?
no, I'm using ASP.NET Yes, I'm using nextjs
lmao
so, is this cart synced to db?
no, its stored in localStorage
just the ids of products
i haven't implemented it yet
why not cookies? :meow_stare:
It'd prefer to store it in local-
@averydelusionalperson why not cookies? <:meow_stare:763826437341839422>
cookies have a limited of data
localStorage can have upto 5 MB
I think you won't store more than this no of ids?
Short mackerel
I use Upstash and Neon to control / manage users
what if a user tries to bulk Orders?
I'm not looking for paid solutions
I made it from scratch once, it had some bugs
@Anay-208 what if a user tries to bulk Orders?
Short mackerel
could you go in more context
4096 characters are enough IMO
like if each id has three digits
each id has around 10-20 digits
+ the size options
:thinq:
What do actually most of the people do? do they make it from scratch
most people will use localStorage or cookies
Answer
or state manager
@Anay-208 What would you recommend me to use for managing user caer `
Short mackerel
Zustand, redux
I prefer localStorage or cookies for Next.js
so they use localStorage and rest of the functionality from scratch?
yeah, it's not like there is much functionality to do
remove/add an object from an array
and stringify it
aight