RouterOptions
Initial router configuration.
Compatibility
ReactAvailable in this renderer's browser integration.
React SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.
PreactAvailable in this renderer's browser integration.
Preact SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.
Import from @kasperrt/smolter/react @kasperrt/smolter/preact
Signature
interface RouterOptions {
url?: string;
/** Explicitly opt into browser history; leave off for SSR and tests. */
browser?: boolean;
hydrationData?: Snapshot;
}Usage
Initial router configuration. browser opts into browser history and defaults to false. url supplies an initial location for memory routing. hydrationData supplies a server snapshot and avoids a duplicate successful initial load.
const router = createDataRouter(routes, {
browser: true,
hydrationData: deserialize(json),
});Fields
url
url?: string;browser
browser?: boolean;Explicitly opt into browser history; leave off for SSR and tests.
hydrationData
hydrationData?: Snapshot;