Interface RouterOptions<T>

Describes a set of options to customize the router behavior.

An extension of the Route type that provides specific data.

An extension of the RouterContext type that provides specific data. The data should be serializable

interface RouterOptions<T> {
    baseURL?: string | URL;
    errorHandler?(error: unknown): MaybePromise<undefined | null | T>;
}

Type Parameters

Properties

Methods

Properties

baseURL?: string | URL

The base URL against which all routes will be resolved. This option is designed for applications hosted on URLs like the following:

https://example.com/path/to/my/root

It doesn't consider URLs from the <base> tag. If you use it, you should provide the base URL manually.

window.location.origin

Methods

  • Invoked when an error is thrown during the resolution process.

    Parameters

    • error: unknown

      The error thrown during the resolution.

    Returns MaybePromise<undefined | null | T>

    A result that will be delivered to the Router.resolve method.

    This function is not called for 404 errors.