Skip to content

getRouter

getRouter(): Router

Defined in: router/router.v2.ts:36

Get the current router instance

Returns

Router

The current router instance, must be called within a router context

Throws

If called outside of a router context

using Router

Example

const router = getRouter();
console.log(router);
// console logs:
// > { container: HTMLElement, push: Function, replace: Function, navigate: Function, ... }