TreeRoutercomponent

TreeRouter({ tree, fallback, ...meta }: TreeRouterProps): ReactNode
ParamType
metaTreeRouterProps
Props for the TreeRouter component — the tree to route plus an optional fallback and app meta. required
    .treeTreeElement
The tree of elements to match routes for. required readonly
    .fallbackReactElement
null
Optional fallback element.
- Explicit null means fallback to nothing (router will not throw NotFoundError). readonly
Return
ReactNode
The resolved element rendered as a page, or the fallback.
Throws
unknown
NotFoundError When no element matches the URL and no fallback is given.

Resolve a URL path to a tree element and render it as a full page.

  • Flattens the tree once (via <TreeProvider>) into a path → element map, then resolves the current URL with a single map.get(path).
  • / renders the root itself; deeper paths render the matching descendant (composite module names like /util/string resolve for free — they're whole keys in the map).
  • The resolved element is already stamped with its canonical path, so the page and its cards link straight to their own paths — nothing needs threading.
  • To override the renderer for a specific element type, wrap in <TreeRouterMapping mapping={…}>.

Examples

<TreeRouter tree={tree} />