lukasbach/react-complex-tree

Get started: Cannot find name "longTree"

Closed this issue · 1 comments

Describe the bug

The longTree variable is undefined in the get started example:
https://rct.lukasbach.com/docs/getstarted#integrating-react-complex-tree-into-your-project

function App() {
  return (
    <UncontrolledTreeEnvironment
      dataProvider={new StaticTreeDataProvider(longTree.items, (item, data) => ({ ...item, data }))}
      getItemTitle={item => item.data}
      viewState={{}}
    >
      <Tree treeId="tree-1" rootItem="root" treeLabel="Tree Example" />
    </UncontrolledTreeEnvironment>
  );
}

It would be better to export a dummy tree data that we can simply import and start with.

Expected behavior

The get started example should be self-contained and can copy-past and run.

The Section "Integrating React Complex Tree into your project" aims to just give a quick understanding of how RCT integrations look like. Sample data that users can copy directly are provided right in the following section: https://rct.lukasbach.com/docs/getstarted#providing-the-data-for-the-tree.

If you want the longTree sample data, you can copy it from this file: https://github.com/lukasbach/react-complex-tree/blob/main/packages/demodata/src/treeData.ts