Skip to content

xstate

API / @xmachines/play-router / xstate

@xmachines/play-router/xstate - the routes of an XState machine

A route of XMachines is a fact about a STATE. This entry point reads that fact out of an XState v5 machine: it walks the machine, collects each meta.route, builds the route tree, and answers the questions that the tree can be asked — which routes are reachable, which are navigable from a state, and which path maps to which state id.

The MAIN entry point holds what happens AFTERWARDS: the route map, the match of a location, the bridge, and the provider lifecycle. It names no machine, and it reads this module never. xstate is therefore an OPTIONAL peer of this package, and a bundler drops @statelyai/graph for a consumer that imports this entry point nowhere.

This is the same shape as @xmachines/play-xstate/routing and @xmachines/play-xstate/view: an optional capability behind its own entry point, with its own dependency.

Example

import { createRouteMap } from "@xmachines/play-router/xstate";
import { connectRouter } from "@xmachines/play-dom-router";
const routeMap = createRouteMap(myMachine);

See

Routing guide

Interfaces

Type Aliases

Functions