Hi @adrianha you can either use route name & params or a url to resolve:
// routes.js
routes.add('search', '/search/:id/:name')
// Route name and params
Router.pushRoute('search', {id: 1, name: 'abc', more: 'things'})
// Or resolve url
Router.pushRoute('/search/1/abc?more=things')
// Or resolve url
Router.pushRoute('/search/1/abc?more=things')
Hello @fridays ,
If i resolved the url using that method, i found that the third options on pushRoute wont take an effect.
Example:
/** getInitialProps is still called */
Router.pushRoute('/search/1/abc?more=things', {}, { shallow: true });
/** getInitialProps is not called as expected which means the options is working */
Router.pushRoute('search', { id: 1, name: 'abc', more: 'things' }, { shallow: true });
Is there any way to pass the options when i resolve the route using url?
Thanks
Pass options as the second argument. When resolving by URL, there is no params argument. We need to make this clear in the readme.
Most helpful comment
Pass options as the second argument. When resolving by URL, there is no params argument. We need to make this clear in the readme.