React Corsair - v0.0.10
    Preparing search index...

    Class Router<Context>

    A router that matches routes by a location.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Returns the array of matched routes and extracted params for a given location.

      Parameters

      • to: To

        The location to match.

      Returns RouteMatch[]

    • Looks up a route in routes that matches a location, loads its data anc component, and notifies subscribers.

      Parameters

      • to: To

        A location or a route to navigate to.

      • options: NavigateOptions = {}

        Navigate options.

      Returns void

    • Prefetches components and data of routes matched by a location.

      The returned promise isn't rejected if component or data loading fails.

      Parameters

      • to: To

        A location or a route to prefetch.

      Returns AbortablePromise<void>

      A promise that can be aborted to discard prefetching.

    • Subscribes a listener to events published by a router.

      Parameters

      • listener: (event: RouterEvent) => void

        A listener to subscribe.

      Returns () => void

      A callback that unsubscribe a listener.

    Properties

    context: Context

    A context provided to route data loaders.

    errorComponent: undefined | ComponentType

    A component that is rendered when an error was thrown during route rendering.

    interceptedController: null | RouteController<any, any, Context> = null

    A controller of the intercepted route, or null if there's no intercepted route.

    isSSR: boolean = ...

    true if the router is used in the server environment.

    loadingAppearance: undefined | LoadingAppearance

    What to render when a component or data are being loaded.

    loadingComponent: undefined | ComponentType

    A component that is rendered when a route is being loaded.

    location: null | Location = null

    The location of the latest router navigation.

    notFoundComponent: undefined | ComponentType

    A component that is rendered if notFound was called during route loading or rendering

    renderingDisposition: undefined | RenderingDisposition

    Where the route is rendered.

    rootController: null | RouteController<any, any, Context> = null

    A root controller rendered in a router Outlet, or null if there's no matching route or if navigation didn't occur yet.

    routes: readonly Route<any, any, any, Context>[]

    Routes that a router can render.