import React, { useContext } from 'react'; import { TreeNodeProps, TreeNodeContext } from '../recursive-tree'; /** * renders the initial tree node, handling virtual nodes (nodes without id, that only have children) */ export function RootNode({ node, depth = 0 }: TreeNodeProps) { const TreeNodeRenderer = useContext(TreeNodeContext); if (node.id) { return ; } if (!node.children) return null; return ( <> {node.children.map((rootNode) => ( ))} ); }