FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Medium

File Explorer III

45 mins

Build a file explorer in React that uses a flat DOM structure (no nested <div>s for children), but still visually represents hierarchy.

Requirements:

  1. Display files and directories in a list, using a flat DOM structure.
  2. Directories:
    • Can contain files and subdirectories.
    • Can be expanded or collapsed by clicking.
    • Should be displayed before files and sorted alphabetically.
  3. Files:
    • Are leaf nodes, cannot be expanded.
  4. Hierarchy must be visually represented by indentation (using styles, not nested DOM).
  5. Focus on functionality and flat structure, not styling.

Code Editor

React Component

00:00
Loading...

Live Preview

See your React component