Skip to content

Commit 3cee71c

Browse files
authored
chore: add dynamic sizing info from ticket to docs (#241)
1 parent fb47f26 commit 3cee71c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,20 @@ function App() {
241241
}
242242
```
243243

244+
### Dynamic sizing
245+
246+
You can add a ref to it with this package [ZeeCoder/use-resize-observer](https://github.com/ZeeCoder/use-resize-observer)
247+
248+
That hook will return the height and width of the parent whenever it changes. You then pass these numbers to the Tree.
249+
250+
```js
251+
const { ref, width, height } = useResizeObserver();
252+
253+
<div className="parent" ref={ref}>
254+
<Tree height={height} width={width} />
255+
</div>
256+
```
257+
244258
## API Reference
245259

246260
- Components

0 commit comments

Comments
 (0)