0
votes

I am trying to set a Route path with a query string. But react-router always sorts query params and shows alphabatically sorted querystring in URL.

For example, I have a location filter page where I add filters to my location list. If I filter "Pakistan": "Lahore", "India": "Delhi", and then "America": "Washington", the URL should look like:

/Search?Pakistan=Lahore&India=Delhi&America=Washington

But URL shows it as follows (alphabetically sorted):

/Search?America=Washington&India=Delhi&Pakistan=Lahore

How can I disable this sorting feature in react-router?

1

1 Answers

0
votes

There is an issue about it.

tl;dr : You have to update your React Router version to 4.x, the 'fix' of this issue will not be included in 3.x future version. You can eventualy create a link with ordered querystring at the end instead of using query object example.