@1771technologies/lytenyte-pro
Version:
Blazingly fast headless React data grid with 100s of features.
10 lines (9 loc) • 382 B
JavaScript
import { computePathTree } from "@1771technologies/lytenyte-shared";
import { useMemo } from "react";
export function useTreeViewPaths(paths, nonAdjacentAreDistinct) {
const tree = useMemo(() => {
const result = computePathTree(paths, {}, nonAdjacentAreDistinct);
return [...result.children.values()];
}, [nonAdjacentAreDistinct, paths]);
return tree;
}