smolter
Types

FetcherWithComponents

The result type of a Preact fetcher, including its bound Form.

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

type FetcherWithComponents<T> = TypedFetcher<RouteData<T>>;

Contract

Aliases TypedFetcher<RouteData<T>>. Includes optional data and error, idle/loading/submitting state, load, submit, and Form. T can be a handler function type or a result type.

import type { FetcherWithComponents } from "@kasperrt/smolter/preact";

interface Preview {
  title: string;
}

export function previewTitle(fetcher: FetcherWithComponents<Preview>): string {
  return fetcher.data?.title ?? "No preview loaded";
}

Usage and limits

Create the value with useFetcher. Do not construct it by hand or assume data is present before a successful load. Its independent state does not represent page navigation.

View implementation ↗