URL, ReactContext, Server for Dashboard?
Answered
Da_v_id posted this in #help-forum
Da_v_idOP
Hi, I am building a dashboard for different projects with a projectSwitcher (I am just using Shadcn's sidebar07), and I was just wondering how should i track the selected project to render the right dashboard? should i store the ID in the URL? should i store it as a react Context + local storage? or add an entry in the database?
Answered by James4u (Tag me if needed)
@Da_v_id well I would suggest to store the id in the url.
7 Replies
@Da_v_id well I would suggest to store the id in the url.
Answer
you can also just use a state/context but I don't see any cons of using id in the url
https://nuqs.47ng.com/
check out above library ⬆️ (I don't mean only search params you can also use dynamic routing if it's okay e.g gmail with several accounts)
check out above library ⬆️ (I don't mean only search params you can also use dynamic routing if it's okay e.g gmail with several accounts)
@Da_v_id any opinion?
Da_v_idOP
apologises for the late response! Yea that makes totally sense, do you know if nuqs helps with queryParams as well? or just Search Query?
what do you mean by query param vs search query? I think they are the same.
or did you mean dynamic path slug?
or did you mean dynamic path slug?
Da_v_idOP
oh right i meant dynamic path slug