AppRoute
A flat application route with optional metadata and lazy-module integration.
Compatibility
Import from @kasperrt/smolter/react @kasperrt/smolter/preact
Signature
interface AppRoute extends Route {
resolveComponent?: () => ComponentType | undefined;
preload?: () => Promise<void>;
id?: string;
routePath?: string;
meta?: MetaFunction;
}Contract
Extends Route with id, routePath, meta, preload, and resolveComponent. path is the pattern matched by the router. Explicit id and the legacy routePath override apply only to manually defined arrays. File routes derive identity and paths from filenames and reject those exports; use [.] for literal dots.
import type { AppRoute } from "@kasperrt/smolter/preact";
export const route: AppRoute = {
id: "task",
path: "/tasks/:id",
loader: ({ params }) => ({ id: params.id }),
};Usage and limits
File-router helpers populate lazy-module hooks. Do not hand-code preload or resolveComponent unless providing your own lazy integration. A route without a default component can act as a resource route on the server.
Fields
resolveComponent
resolveComponent?: () => ComponentType | undefined;preload
preload?: () => Promise<void>;id
id?: string;Stable identifier for targeted revalidation; defaults to the path.
routePath
routePath?: string;meta
meta?: MetaFunction;