Is there a way to pass params to the router?
fermartz opened this issue · comments
Hey guys,
In few words I'm trying to create a page where I will display related topics. Imagine when you have a blog and you have tags and categories. If you click a tag the system will take you to search results.
This is how I would do it in a 'normal' react app but I'm a bit confused about how to do it in X0 since the system is creating the routes 'automagically' for us.
<Route path = "search/:id" component={Search}></Route>
Any help would be greatly appreciated!!!
It's undocumented and experimental, but you can return a path
in getInitialProps
as seen here: https://github.com/c8r/blog/blob/master/pages/post.js#L20 – You'll also want to return a subroutes routes
array in order for the static build to know what to export
Thanks Brent!
I'll take a look and try to implement it in my project.