smolter
Types

Params

Path parameters captured by a matched route.

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 Params = Record<string, string>;

Usage

Path parameters captured by a matched route. Keys and values are strings. Read a named key only when the active route declares it; a wildcard uses the key *. Query parameters are separate.

const { id } = useParams();
const query = new URL(request.url).searchParams.get("q");
View implementation ↗