Function: getRoutableRoutes()
API / @xmachines/play-router / getRoutableRoutes
function getRoutableRoutes(tree): RouteNode[];Defined in: query.ts:106
Returns every route of the tree that has a route, in one flat array
The function returns each route with a meta.route field. It returns no state
without a route, and no synthetic root node. Use it to generate a router
configuration in a framework adapter dynamically.
Parameters
| Parameter | Type | Description |
|---|---|---|
tree | RouteTree | The route tree, from extractMachineRoutes() |
Returns
The array of the route nodes with a route, with their path and their stateId
Example
const tree = extractMachineRoutes(machine);const routes = getRoutableRoutes(tree);// [// { path: '/', stateId: '#home', ... },// { path: '/about', stateId: '#about', ... },// { path: '/profile/:userId', stateId: '#profile', ... }// ]