smolter
Types

ClientRouteModule

Browser-safe exports accepted by serverRoute.

Compatibility

ReactAvailable in this renderer's browser integration.
React SSRClient-side setup for an SSR application; do not execute on the server.
PreactAvailable in this renderer's browser integration.
Preact SSRClient-side setup for an SSR application; do not execute on the server.

Import from @kasperrt/smolter/react/client @kasperrt/smolter/preact/client

Signature

interface ClientRouteModule {
  id?: string;
  default?: unknown;
  HydrateFallback?: unknown;
  ErrorBoundary?: unknown;
  clientLoader?(args: ClientLoaderArgs): unknown;
  clientAction?(args: ClientActionArgs): unknown;
  shouldRevalidate?: RouteModule["shouldRevalidate"];
}

Usage

Browser-safe exports accepted by serverRoute. It deliberately excludes server loader and action implementations. Use clientLoader/clientAction with their call-through callbacks when browser-side coordination is needed.

const browserModule = { default: Task, clientLoader, clientAction };
const route = serverRoute("/tasks/:id", browserModule);

Fields

id

id?: string;

default

default?: unknown;

HydrateFallback

HydrateFallback?: unknown;

ErrorBoundary

ErrorBoundary?: unknown;

clientLoader

clientLoader?(args: ClientLoaderArgs): unknown;

clientAction

clientAction?(args: ClientActionArgs): unknown;

shouldRevalidate

shouldRevalidate?: RouteModule["shouldRevalidate"];
View implementation ↗