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.15k stars 96 forks source link

let consumer pass their own query string implementation #171

Closed y-nk closed 2 years ago

y-nk commented 3 years ago

peer dependency on query-string is a bit of a constraint ; lots of people use different libraries and dont want to carry 2 libraries doing the same thing. I'm personally using qs which is quite more popular/downloaded and support some cases which are not supported by query-string.

it'd be probably beneficial to have a qsParser object which we can set, of type:

interface QueryStringParser {
  parse(str: string): Object,
  stringify(obj: any): string,
}
pbeshai commented 2 years ago

I do like this idea. would be nice not to require query-string (and also to allow people to use URLSearchParams if they so choose)

pbeshai commented 2 years ago

Hi there, this has been added to v2.0.0-rc.0. See the changelog for details.