Build a file explorer: a nested folder hierarchy where clicking a folder expands or collapses its contents. The data is a tree — folders contain children, which may themselves be folders — and the natural way to render a tree is recursion: a component that renders a node and calls itself for each child.
type FileNode = { name: string; children?: FileNode[] };
// A self-contained component. No props.
function App(): JSX.Element;
A node with a children array is a folder; one without is a file.
▸ src click ▸ src ▾ src
▸ public → ▸ components
📄 package.json 📄 index.ts
▸ public
📄 package.json
expanding "src" then "components" reveals Button.tsx and Modal.tsx,
each one level deeper than its parent.
Set; a folder is open iff its path is in the set.children present → folder (expandable); absent → leaf file.