Use dynamic route parameters
mainUse a colon (:) to define a flexible segment in a path. This segment acts as a parameter that can be accessed within the component using the useParams hook.
<Route path="/users/:id" component={User} />Note on Animation/Transitions: Routes sharing the same path match are treated as the same route. To force a re-render when parameters change, wrap your component in a keyed <Show>:
<Show when={params.something} keyed>
<MyComponent />
</Show>import { lazy } from "solid-js";
import { render } from "solid-js/web";
import { Router, Route } from "@solidjs/router";
const Users = lazy(() => import("./pages/Users"));
const User = lazy(() => import("./pages/User"));
const Home = lazy(() => import("./pages/Home"));
render(
() => (
<Router>
<Route path="/users" component={Users} />
<Route path="/users/:id" component={User} />
<Route path="/" component={Home} />
</Router>
),
document.getElementById("app")
);