Skip to content

Function: getNavigableRoutes()

Documentation / @xmachines/play-router / getNavigableRoutes

function getNavigableRoutes(tree, stateId): RouteNode[];

Defined in: query.ts:20

Get all routes navigable from given state

Returns child routes of the specified state. Future enhancement will include sibling routes reachable via transitions.

Parameters

ParameterTypeDescription
treeRouteTreeRoute tree from extractMachineRoutes()
stateIdstringCurrent state ID

Returns

RouteNode[]

Array of route nodes reachable from state

Example

const tree = extractMachineRoutes(machine);
const routes = getNavigableRoutes(tree, "dashboard");
// [{ id: 'overview', path: '/overview', ... }, { id: 'settings', ... }]