Best Approach for Date Picker
Unanswered
Bombay posted this in #help-forum
BombayOP
I’ve got a Date Picker component nested within a server component that serves to modify the date range to be used in the server component’s data fetching logic.
My concern is with tracking the state of the user’s selected date range on both the server and client.
I know that searchParams would achieve this functionality but I’m wondering if there is a better practice, I don’t like adding params to URL if it’s not necessary.
Let me know your thoughts on this, looking to improve this pattern as it’s something I’ve been considering for some time now.
My concern is with tracking the state of the user’s selected date range on both the server and client.
I know that searchParams would achieve this functionality but I’m wondering if there is a better practice, I don’t like adding params to URL if it’s not necessary.
Let me know your thoughts on this, looking to improve this pattern as it’s something I’ve been considering for some time now.
1 Reply
This is something you probably want to keep in the URL in case you want the selected date to maintain when hard refreshing the page or sharing a link.
Making the URL the source of truth for both the server and client components sounds like a good approach, also, a native approach
Making the URL the source of truth for both the server and client components sounds like a good approach, also, a native approach