pbeshai / use-query-params

React Hook for managing state in URL query parameters with easy serialization.
https://pbeshai.github.io/use-query-params
ISC License
2.13k stars 95 forks source link

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

Open rmmanseau opened 1 year ago

rmmanseau commented 1 year ago

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!