fridays / next-routes

Universal dynamic routes for Next.js
MIT License
2.47k stars 230 forks source link

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

Closed Sergey2095 closed 1 year ago

Sergey2095 commented 6 years ago

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

izzappel commented 5 years ago

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?