Function: isAbsoluteRoute()
API / @xmachines/play-xstate / isAbsoluteRoute
function isAbsoluteRoute(path): boolean;Defined in: packages/play-xstate/src/routing/derive-route.ts:163
Tells you if the route path is absolute
The function decides if a route path is absolute, which means that it starts with
/, or relative. An absolute path inherits nothing from a parent route. A
relative path joins a parent path, for a nested routing.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | The route path to test |
Returns
boolean
true when the path starts with ’/’. In every other case, false
Example
import { isAbsoluteRoute } from "@xmachines/play-xstate";
console.log(isAbsoluteRoute("/dashboard")); // trueconsole.log(isAbsoluteRoute("settings")); // falseconsole.log(isAbsoluteRoute("./about")); // falseSee
deriveRoute for the read of a route