UNPKG

@awsui/components-react

Version:

AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A

9 lines (8 loc) 502 B
import { useResizeObserver } from '../../internal/hooks/container-queries'; import { useCallback } from 'react'; var extractHeight = function (rect) { return rect === null || rect === void 0 ? void 0 : rect.borderBoxSize[0].blockSize; }; export function useObservedElement(selector) { var _a; var getElement = useCallback(function () { return document.querySelector(selector); }, [selector]); return (_a = useResizeObserver(getElement, extractHeight)) !== null && _a !== void 0 ? _a : 0; }