TreeProvidercomponent
TreeProvider({ tree, children }: { readonly tree: TreeElement; readonly children: ReactNode }): ReactNode| Param | Type | |
|---|---|---|
props | { readonly tree: TreeElement; readonly children: ReactNode } | The tree to flatten and provide, plus children. required |
| Return | |
|---|---|
ReactNode | A <TreeContext> provider wrapping the children with the flattened map. |
Provide a tree to descendants as a flattened lookup map (see flattenTree()).
- Flattens
treeonce (memoised) when set — not on every lookup in every element. - Merges onto any parent
<TreeProvider>'s map, so cross-references resolve across an entire nested set of trees; the outer (parent) tree wins on collision.
Examples
<TreeProvider tree={tree}>{children}</TreeProvider>