How to write the custom hook 'useStateQuery' similar to Nuqs for '@tanstack/react-router'.
I'm working on implementing a
useQueryState
hook that is similar in functionality to Nuqs but utilizing @tanstack/react-router
for handling query parameters. The implementation involves a Parser
utility for parsing and stringifying different data types (string, number, boolean) and a hook that syncs state with query parameters.
Here is the current implementation:
Provide right way to do it.1 Reply
frail-apricot•4mo ago
I have an implementation of this, without the
parser
stuff because that's already handled by tanstack, but with type-safety