Say I have a route defined like this
<Route
path="/blog-post/{id:Int}"
page={BlogPostPage}
name="blogPost"
/>
when I navigate to this route using this code
navigate(blogPost(1)
How can append query param like this: "/blog-post/1?param=xxx
HI @dingzhanjun , please look at the Router param docs here: Router | RedwoodJS Docs
If you specify parameters to the named route function that do not correspond to parameters defined on the route, they will be appended to the end of the generated URL as search params in key=val
format:
<Link to={routes.users({ sort: 'desc', filter: 'all' })}>...</Link>
// => "/users?sort=desc&filter=all"
You can add them in addition to your id:
navigate(blogPost({ id: 1, param: 'xxx' })
1 Like