From fdfb1afeedb766782dc084b1bd3412db36c4da02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Pi=C3=B1=C3=B3n?= <51218118+gonzalo-novak@users.noreply.github.com> Date: Sat, 19 Oct 2024 14:58:58 -0600 Subject: [PATCH] Update README.md --- README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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