fridays / next-routes

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

how to add get Parameters? #93

Closed huvber closed 6 years ago

huvber commented 7 years ago

Hi, I wanted to say you thanks for you work, it's great. I'm using your Link component but I need to add also getParams like '?key=value&another=value'

It's possible to set the query of the href of the Next's Link component. ?

something like this:

<Link route="my-route" params={{slug: 'my-article'}} query={{key: 'value', another: 'value'}}>press me</Link>
fridays commented 7 years ago

Hey, you can do that by passing the extra parameters with the params prop. All params that are not defined in the route pattern will be added as querystring.

signalwerk commented 6 years ago

The same is not true for Router.pushRoute('/home', {key: 'value', another: 'value'}) right? Here I have to encode by hand if I have extra params: Router.pushRoute('/home?key=value&another=value')