Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
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.4.78/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.