Function: getNavigableRoutes()
API / @xmachines/play-router / getNavigableRoutes
function getNavigableRoutes(tree, stateId): RouteNode[];Defined in: query.ts:41
Returns every route of a navigation from the given state
The function returns the child routes of the state. A later version also returns the sibling routes of a transition.
Parameters
| Parameter | Type | Description |
|---|---|---|
tree | RouteTree | The route tree, from extractMachineRoutes() |
stateId | string | The ID of the current state |
Returns
The array of the route nodes that the state can reach
Example
const tree = extractMachineRoutes(machine);const routes = getNavigableRoutes(tree, "dashboard");// [{ id: 'overview', path: '/overview', ... }, { id: 'settings', ... }]