Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/netzo/deps/usehooks-ts.ts>useResizeObserver

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
function useResizeObserver
import { useResizeObserver } from "https://deno.land/x/netzo@0.5.63/deps/usehooks-ts.ts";

Custom hook for observing the size of an element using the ResizeObserver API.

Examples

const myRef = useRef(null); const { width = 0, height = 0 } = useResizeObserver({ ref: myRef, box: 'content-box', });

Type Parameters

optional
T extends HTMLElement = HTMLElement
  • The type of the element to observe.

Parameters

options: UseResizeObserverOptions<T>
  • The options for the ResizeObserver. (default is {}).

Returns

UseResizeObserverResult
  • The size of the observed element.