TreeRoutercomponent
TreeRouter({ tree, fallback, ...meta }: TreeRouterProps): ReactNode| Param | Type | |
|---|---|---|
meta | TreeRouterProps | Props for the TreeRouter component — the tree to route plus an optional fallback and app meta. required |
.tree | TreeElement | The tree of elements to match routes for. required readonly |
.fallback | ReactElementnull | 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 apath→ element map, then resolves the current URL with a singlemap.get(path). /renders the root itself; deeper paths render the matching descendant (composite module names like/util/stringresolve 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} />