Skip to content

Interface: RouteMapping

API / @xmachines/play-react-router / RouteMapping

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

A single state ID ↔ path mapping entry.

Both fields are readonly — mappings are immutable once passed to RouteMap. Adapter packages re-export a structurally compatible RouteMapping type under their own name. This type is published from @xmachines/play-router as RouteMapping to avoid name collisions with those adapter-local types.

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
pathreadonlystringURL path pattern (e.g., "/", "/profile/:userId", "/settings/:section?")play-router/src/base-route-map.ts:61
stateIdreadonlystringState machine state ID (e.g., "home", "#profile")play-router/src/base-route-map.ts:59