@react-hookz/web
Version:
React hooks done right, for browser and SSR.
12 lines (11 loc) • 391 B
TypeScript
import type { RefObject } from 'react';
export type Measures = {
width: number;
height: number;
};
/**
* Uses ResizeObserver to track element dimensions and re-render component when they change.
*
* @param enabled Whether resize observer is enabled or not.
*/
export declare function useMeasure<T extends Element>(enabled?: boolean): [Measures | undefined, RefObject<T | null>];