useResizeObserver ​
Hook that gives you resize observer state
typescript
import { useResizeObserver } from '@siberiacancode/reactuse';
Usage ​
typescript
const { ref, entries } = useResizeObserver();
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
options.enabled? | boolean | true | The IntersectionObserver options |
options.box? | boolean | - | The IntersectionObserver options |
options.onChange? | (entries: ResizeObserverEntry[], observer: ResizeObserver) => void | - | The callback to execute when resize is detected |
Parameters
Name | Type | Default | Note |
---|---|---|---|
target | Target | - | The target element to observe |
options.enabled? | boolean | true | The IntersectionObserver options |
options.box? | boolean | - | The IntersectionObserver options |
options.onChange? | (entries: ResizeObserverEntry[], observer: ResizeObserver) => void | - | The callback to execute when resize is detected |