Skip to content

Interface: RouteMapping

API / @xmachines/play-tanstack-solid-router / RouteMapping

Defined in: play-router/src/base-route-map.ts:54

One entry of the map between a state ID and a path.

Both fields are readonly, because a mapping is immutable after the caller gives it to RouteMap. An adapter package re-exports a structurally compatible RouteMapping type under its own name. @xmachines/play-router publishes this type as RouteMapping, and its name therefore does not collide with such a local type of an adapter.

Example

const mapping: RouteMapping = { stateId: "home", path: "/" };
const paramMapping: RouteMapping = { stateId: "profile", path: "/profile/:userId" };
const optionalMapping: RouteMapping = { stateId: "settings", path: "/settings/:section?" };

Properties

PropertyModifierTypeDescriptionDefined in
pathreadonlystringThe pattern of the URL path, for example "/", "/profile/:userId", or "/settings/:section?"play-router/src/base-route-map.ts:58
stateIdreadonlystringThe state ID of the state machine, for example "home" or "#profile"play-router/src/base-route-map.ts:56