Skip to content

Commit da2e93e

Browse files
committed
Update useResizeObserverEntry API documentation
1 parent ddc346e commit da2e93e

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

docs/api.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,12 +490,17 @@ const MyObservedComponent = () => {
490490

491491
# `useResizeObserverEntry()`
492492

493-
⚠️ **Advanced usage** — This hook is used internally in [`useBreakpoints()`](#usebreakpoints) to retrieve the `ResizeObserverEntry` instance set by [`<Observe>`](#observe). It allows you to manually extract [its properties](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry), most notably `.borderBoxSize`, `.contentBoxSize`, and `.devicePixelContentBoxSize`. This hook takes no arguments.
493+
⚠️ **Advanced usage** — This hook is used internally in [`useBreakpoints()`](#usebreakpoints) to retrieve the `ResizeObserverEntry` instance set by [`<Observe>`](#observe). It allows you to manually extract [its properties](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry), most notably `.borderBoxSize`, `.contentBoxSize`, and `.devicePixelContentBoxSize`.
494+
495+
The hook takes an optional `ResizeObserverEntry` as its second argument. **If you pass one, `useResizeObserverEntry()` will not fetch it from the [context](#context), so use caution!**
494496

495497
## Reference guide
496498

497499
```javascript
498-
const resizeObserverEntry = useResizeObserverEntry();
500+
const resizeObserverEntry = useResizeObserverEntry(
501+
/* (optional) a ResizeObserverEntry to use instead of the one provided on context */
502+
injectResizeObserverEntry
503+
);
499504
const fragmentIndex = 0;
500505

501506
/* retrieve width and height from legacy `contentRect` property */

0 commit comments

Comments
 (0)