-
-
Notifications
You must be signed in to change notification settings - Fork 179
Open
Description
Example:
import { Router, Route, Link } from "wouter";
function ScheduleOverview() {
return (
<div>
<h1>Schedule Overview</h1>
<Link href="/2026-02-11">Go to Feb 11</Link>
</div>
);
}
function ScheduleDetail({ date }) {
return (
<div>
<h1>Schedule for {date}</h1>
{/* Expected: navigates to /app/schedule */}
{/* Actual: navigates to /schedule (missing /app base) */}
<Link href="~/schedule">Back to Overview</Link>
</div>
);
}
function App() {
return (
<Router base="/app">
<Route path="/schedule" nest>
<Route path="/">
<ScheduleOverview />
</Route>
<Route path="/:date">
{({ date }) => <ScheduleDetail date={date} />}
</Route>
</Route>
</Router>
);
}- Navigate to /app/schedule/2026-02-11
- Click "Back to Overview" link
- Expected: navigates to /app/schedule
- Actual: navigates to /schedule (base path /app is not applied)
I understand from the docs (under Router) that the ~ is an escape hatch to navigate to an absolute path since /-prefixed urls are relative to the parent route, but is there a way to route relative to the base?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels