createRouter()

Creates and initializes an LWR router.

Properties

Method Input Type Required/Optional Description
config RouterConfig object Optional Pass in the RouterConfig object you want to create a router for. If you don't specify a RouterConfig, LWR creates a router with default values.

note: We recommend that you specify a RouterConfig for createRouter(). If you don't pass in a value for RouterConfig.routes, the router can't match any locations.

Syntax

import { createRouter } from 'lwr/router';

createRouter(config?: RouterConfig
    ): Router<PageReference>

Returns

See Also