The configuration for a new router instance.

This class should rarely be used directly. Instead, use the Router component to create a new router instance.

Constructors

Properties

basePath?: string

The base path for the router instance.

If no value is provided, the base path will be "/".

children?: Route[]

The children for the router instance.

hooks?: { post?: Hook | Hook[]; pre?: Hook | Hook[] }

Hooks to be run before and after the routes are rendered at the router level (independent of the route hooks if applicable).

If no value is provided, no hooks will be run.

id?: string

The id for the router instance.

If no value is provided, the id will be a random string of characters.

initialPath?: string

The initial path for the router instance.

If no value is provided, the initial path will be the current path of the browser.

notFoundComponent?: Component<any>

The not found component for the router instance.

If no value is provided and no route could be found, the router will will not render anything.

renavigation?: boolean

Whether to allow the same route to be rendered if the conditions are the same (taking in to account the path, query, and status code).

routes: RouteConfig[]

The routes for the router instance.

statuses?: Partial

The default components rendered when a route is not found and the status code is in one of the following: 400, 401, 403, 404, 500

If no value is provided, the default components will not be rendered.