Access dynamic route params in components outside of the FileRouter

In this structure:
<Body class="h-full bg-slate-900 text-slate-300">
<ErrorBoundary>
<Suspense fallback={<div>Loading</div>}>
<O_header />

<Routes>
<FileRoutes />
</Routes>
<O_Footer></O_Footer>
</Suspense>
</ErrorBoundary>
<Scripts />
</Body>
<Body class="h-full bg-slate-900 text-slate-300">
<ErrorBoundary>
<Suspense fallback={<div>Loading</div>}>
<O_header />

<Routes>
<FileRoutes />
</Routes>
<O_Footer></O_Footer>
</Suspense>
</ErrorBoundary>
<Scripts />
</Body>
I need the header to render the following: <A href={/${params.lang}/sign_in} class="navAction"> where lang is derived from this url http://localhost:3000/en however params.lang is undefined unless its inside a route
4 Replies
Braveheart
BraveheartOP2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Braveheart
BraveheartOP2y ago
how would that look? index:
import { createServerData$, redirect } from 'solid-start/server';

export function routeData() {
return createServerData$((_, { request }) => {
// TODO parse accept-language header
throw redirect('/en');
});
}

export default function Index() {
return <div>Redirecting...</div>;
}
import { createServerData$, redirect } from 'solid-start/server';

export function routeData() {
return createServerData$((_, { request }) => {
// TODO parse accept-language header
throw redirect('/en');
});
}

export default function Index() {
return <div>Redirecting...</div>;
}
thx
Braveheart
BraveheartOP2y ago
it works
Want results from more Discord servers?
Add your server