Skip to content
filedom
Esc
↑↓navigate↵open⌘Jpreview
On this page

useVirtualTree

Reads the filesystem tree and its mutation actions.

import { useVirtualTree } from 'filedom';

const { tree, isLoading, error, refresh } = useVirtualTree();

Call it inside a VirtualTreeProvider; outside one it throws. The actions change real files.

Returns

  • tree: VirtualDesktop | null, isLoading: boolean, error: Error | null.
  • refresh(): Promise<void>.
  • renameItem(id, newName): Promise<void>.
  • deleteItem(id): Promise<void>.
  • addItem(parentId, name, type): Promise<void>; type is file or folder, and null parent means the root.

Was this page helpful?