Table of Contents

Method RouterProvider

Namespace
Velvet
Assembly
Velvet.Docs.dll

RouterProvider(Router, string?)

Root of a routed tree: subscribes to router and publishes it, with its location, loader data and loader errors, to the routing hooks, then renders the matched route through an Outlet(object?, string?) of its own. Mount it above everything that navigates, and once: rendered beneath another, it throws System.InvalidOperationException, as React Router's Router does.

public static ComponentNode RouterProvider(Router router, string? key = null)

Parameters

router Router

The router to publish. Navigation may start before or after this mounts.

key string

Key used to disambiguate siblings at the same position.

Returns

ComponentNode

A ComponentNode publishing the router's state to its subtree.

Remarks

It takes no children, as React Router's RouterProvider does not: what renders beneath it is the route table's own elements. A value for UseOutletContext comes from an Outlet(object?, string?) written in a layout route, which is where React Router's <Outlet context> lives too.