Working with objects #964
Answered
by
franky47
ForeshadowRU
asked this question in
Q&A
|
Hi. I want to create helpers that will manager state for my filters. I need for my url to look like: But using nuqs I am getting url like /admin/entity?filter=filter[stage]=All Reproduction sandbox: https://codesandbox.io/p/sandbox/4k4skv Can someone explain me why there is "filter=" part and how can I get rid of it? |
Answered by
franky47
Apr 6, 2025
Replies: 1 comment 3 replies
|
The parse and serialize functions in custom parsers only work on the values of the search params, but here by using qs you're specifying the key again as part of the value. |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What I can see is that your keys are dynamic: they contain the name of the final key in the resulting object. Assuming you can enumerate the properties you want to support in that object, you could do something like this:
urlKeysfeature to remap those logical property names into dynamic keys in the url, by adding thefilter[${property}]formatuseQueryStatesExample: