@acusti/use-bounding-client-rect
Version:
React hook that returns the boundingClientRect for an element and triggers an update when those dimensions change
15 lines (14 loc) • 326 B
TypeScript
type EmptyRect = {
bottom: undefined;
left: undefined;
right: undefined;
top: undefined;
};
type Rect = {
bottom: number;
left: number;
right: number;
top: number;
};
declare const useBoundingClientRect: (element?: HTMLElement | null) => EmptyRect | Rect;
export default useBoundingClientRect;