File Explorer
Watch the walkthrough
Open on InstagramExercise: Build a recursive file explorer
Render a nested tree of folders and files from records containing an ID, name, type, and children. Folders expand/collapse independently; selecting a file shows its name or content in a preview panel.
Requirements
- Use recursion for nested folders and stable IDs for node identity.
- Track expanded folder IDs separately from the selected file ID.
- Support empty folders, duplicate names in different folders, and deeply nested structures.
- Expose expansion state accessibly; either implement tree keyboard interactions or use nested lists with native disclosure buttons.
Acceptance checks and discussion
Expand two siblings, select a nested file, then collapse its parent. Define whether selection remains active. Add rename/create/delete as an extension using immutable tree updates, and reject deleting a node without handling selected descendants.
The brief above is an original practice specification. The linked sandbox is supporting solution material and may implement a simpler subset of these requirements.