Getting params in wrapped/nested routes
See original GitHub issueimport { Outlet } from "solid-app-router";
function PageWrapper () {
return <div>
<h1> We love our users! </h1>
<Outlet/>
<Link href="/">Back Home</Link>
</div>
}
<Route path="/users" element={<PageWrapper/>}>
<Route path="/" element={<Users/>} />
<Route path="/:id" element={<User/>} />
</Route>
In this example, it seems that there is no way to get the “id” parameter from within the PageWrapper component. This is, as far as I can tell, due to parameters not being held by the global Router context, but rather the local Route context. Are there any workarounds for this?
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Nested routes and parameters · Issue #854 - GitHub
Hello,. I'm having an issue creating nested routes where the parent route contains a parameter. This is my desired end result:.
Read more >Overriding params in nested routes - ruby on rails
I want my routes to look like :user_id/:project_id/:issue_id and I want it to be consistent for all the models.
Read more >How to Use Nested Routes in React Router 6
Nested Routes and useParams In the <Post /> component we can get the parameter 123 by importing useParams. Then in the body of...
Read more >React Router 6 Tutorial #4 - Nested Routes - YouTube
Get access to premium courses on Net Ninja Pro:https://netninja.dev/courses My Udemy ...
Read more >Advanced routing • Docs • SvelteKit
If you want to render the nested error page, you should create a route ... You can do that by wrapping the parameter...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If this is not intended, I am open to creating a pull request for this, however, changing the current behavior of useParams to pull from the global router may break some code which expects to only get parameters from the current Route context provider. To avoid that, should I create a new function such as
useGlobalParams
?Any one interested in this willing do a little leg work for me? We made a choice that seemed sensible, mostly that this decision might lead us to a path where we’d need to reactively account for things that don’t exist. Ie… have to use proxies. Seemed sort of dangerously leaky. But I’d consider it if this was pretty standard. So do other client routers allow this?
The next thing I’d be doing is looking at React Router, Tanstack Router, Next Router, Sveltekit Router, Nuxt Router, etc… and determining if they had this functionality.