TreeProvidercomponent

TreeProvider({ tree, children }: { readonly tree: TreeElement; readonly children: ReactNode }): ReactNode
ParamType
options{ readonly tree: TreeElement; readonly children: ReactNode }
required
Return
ReactNode

Provide a tree to descendants as a flattened lookup map (see flattenTree()).

  • Flattens tree once (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>