type MyPayload = {
name: string
};
const MyNodeRenderer = (props: TreeNodeComponentProps<Tree<MyPayload>>) => {
return <div>{props.value.name}</div>
}
const App = () => {
const myTree = useTree<MyPayload>();
return <TreeView value={myTree} renderer={MyNodeRenderer} />
}
Renders a given tree with each node being rendered by the included renderer component prop. TreeView is memoized using React.memo