Data Loading
Load route data on server and client with typed loaders.
Updated: 2026-02-23
Route loader
Export loader(ctx) from a page module. Loader output is available as ctx.data in the page component.
src/pages/[lang]/docs/[slug].tsx
export function loader(ctx) {
return {
slug: ctx.params.slug,
tab: ctx.searchParams.get("tab") ?? "overview",
};
}Not found flow
Throw notFound() in loader/component to route execution into your not-found entity.