Skip to content

Getting params in wrapped/nested routes #122

@EthanYidong

Description

@EthanYidong
import { 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions