ctx.location
Current route location information, equivalent to the React Router location object. It is typically used in conjunction with ctx.router and ctx.route to read the current path, query string, hash, and state passed through the route.
Use Cases
Note:
ctx.locationis only available in RunJS environments with a routing context (e.g., JSBlock within a page, FlowEngine, etc.); it may be null in pure backend or non-routing contexts (e.g., Workflows).
Type Definition
Location comes from react-router-dom, consistent with the return value of React Router's useLocation().
Common Fields
Relationship with ctx.router and ctx.urlSearchParams
ctx.urlSearchParams is parsed from ctx.location.search. If you only need query parameters, using ctx.urlSearchParams is more convenient.
Examples
Branching Based on Path
Parsing Query Parameters
Receiving State Passed via Route Navigation
Locating Anchors via Hash
Related
- ctx.router: Route navigation; the
statefromctx.router.navigatecan be retrieved viactx.location.stateon the target page. - ctx.route: Current route match information (parameters, configuration, etc.), often used in conjunction with
ctx.location.

