diff --git a/README.md b/README.md index fc5ffe9..be857d2 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,8 @@ function App() { return ( >` | Required | Callback function called when the tree structure changes. | +| `treeStructure` | `OptimizedTreeStructure` | Required | The array of tree items to be rendered. | +| `setTreeStructure` | `React.Dispatch>` | Required | Callback function called when the tree structure changes. | | `indentationWidth` | `number` | `undefined` | The indentation width for children elements. | | `isCollapsible` | `boolean` | `false` | Determines if tree items can be collapsed/expanded. | | `onLazyLoadChildren` | `(id: UniqueIdentifier, isExpanding: boolean) => Promise` | `undefined` | Callback for lazy loading child items when a parent is expanded. Useful for getting child items from an API endpoint | @@ -110,6 +110,15 @@ The `OptimizedTreeStructure` is used internally to improve performance for large function createOptimizedTreeStructure(items: TreeItems): OptimizedTreeStructure; ``` +### getItemById +Retrieves a tree item by its unique identifier. +```typescript +function getItemById( + structure: OptimizedTreeStructure, + id: UniqueIdentifier, +): TreeItem | undefined; +``` + ### removeItemById ```typescript