Closed adrianha closed 7 years ago
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.
Hi @fridays , Is it possible to navigate like this?
Router.pushRoute('/search', { id: 1, name: 'abc' });
It looks like that params is not passed when given the path in the first parameter. Heres the example repo: Example