Function: findRouteById()
Documentation / @xmachines/play-router / findRouteById
function findRouteById(tree, id): RouteNode | undefined;Defined in: index.ts:69
Find route node by state ID
Looks up route node using the state’s ID property. Used to get URL path from state ID for browser URL sync after play.route transitions.
Parameters
| Parameter | Type | Description |
|---|---|---|
tree | RouteTree | Route tree from extractMachineRoutes |
id | string | State ID (e.g., ‘dashboard’, ‘settings.profile’) |
Returns
RouteNode | undefined
Route node if found, undefined otherwise
Example
const tree = extractMachineRoutes(machine);const node = findRouteById(tree, "dashboard");if (node) { console.log(node.fullPath); // '/dashboard'}