Skip to content

Function: getRoutableRoutes()

Documentation / @xmachines/play-router / getRoutableRoutes

function getRoutableRoutes(tree): RouteNode[];

Defined in: query.ts:50

Get all routable routes from tree as flat array

Returns all routes that have meta.route defined, excluding non-routable states and the synthetic root node. Useful for dynamically generating router configurations in framework adapters.

Parameters

ParameterTypeDescription
treeRouteTreeRoute tree from extractMachineRoutes()

Returns

RouteNode[]

Array of routable route nodes with path and stateId

Example

const tree = extractMachineRoutes(machine);
const routes = getRoutableRoutes(tree);
// [
// { path: '/', stateId: '#home', ... },
// { path: '/about', stateId: '#about', ... },
// { path: '/profile/:userId', stateId: '#profile', ... }
// ]