next-routes icon indicating copy to clipboard operation
next-routes copied to clipboard

How to set get parameter with same key and different values example.com/?key=1&key=2&key=3

Open Sergey2095 opened this issue 5 years ago • 1 comments

with 'next/router' we can write Router.push({ pathname: pathname, query: { key:[1,2,3] } });

Sergey2095 avatar Oct 24 '18 10:10 Sergey2095

I have the same problem. Since next.js is using querystring to parse the url, an array as a query param cannot be parsed anymore. Having an array as a query property: { key: [1,2,3] } gets this url: http://locahost:xxxx/path?key=1%2F2%2F3

Using the withRouter from next/routes the query has a string value then: { key: "1/2/3" } instead of parsing an array again.

Why can't you use the querstring.stringify function instead to be aligned with next.js?

izzappel avatar Mar 15 '19 10:03 izzappel