pbeshai / use-query-params

React Hook for managing state in URL query parameters with easy serialization.

Home Page:https://pbeshai.github.io/use-query-params

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature request: export removeDefaults for end users, or add an option to encodeQueryParams

rmmanseau opened this issue · comments

this package is super useful, especially because it exposes a bunch of its internal functions, ie. encodeQueryParams & decodeQueryParams. The hooks API is great if you can use it, but for situations where you need to make some updates without being able to access hooks (ie from a redux thunk) its super useful to be able to drop into the more primitive functions.

one of the ones that is missing, however, is removeDefaults. the only default way for a user to access this functionality is via the hooks API. it can be imported if you specify the full path, "use-query-params/src/removeDefaults", but it breaks webpack for me and its not officially supported & so it might break if the library shuffles around its internals.

it would be great if you could export it, or allow the user to optionally enable it when encodeQueryParams is called. thanks!