-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify why and how nested routing #841
Comments
The docs could be clearer on a few points I think:
First what you described doesn't sound like nested routes. It sounds like you want parallel routes. To get the expected behavior you have described you could do this: export const routes = [{
path: '/',
component: Root,
}, {
path: '/home',
component: Home,
},
{
path: '/view',
component: View,
}]; In this case when it matches to any of these paths it will show the related component. Nested routes are when you want one route inside the other. In order to do that you need to indicate where it will be inserted. This is done with So inside your root component you could: function Root(props) {
return <div>Root {props.children}</div>;
} This will insert the nested route inside this div next to the text Root. The other thing that is a bit special here is we only match on routes that exist.. We don't render a route without children. So nested routes need to have a pathless or Here is the updated example. https://stackblitz.com/edit/github-aqy729-qdxvdk?file=src%2Fapp.tsx In any case this isn't a bug so much as a documentation shortcoming.. so moving to docs. |
Start a new pull request in StackBlitz Codeflow. |
Ah! Of course 🤦. Thanks for the thorough clarification. How do I render an index route with the nesting approach? For example, if I were to want everything under |
nm, I got my answer:
|
Describe the bug
I'm not able to render my UI when I set up a route config with nested routes using solid-start.
Following documentation from here
Your Example Website or App
https://stackblitz.com/edit/github-aqy729
Steps to Reproduce the Bug or Issue
Expected behavior
I would expect for:
Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: