diff --git a/packages/web-api-hooks/src/useSize.ts b/packages/web-api-hooks/src/useSize.ts index aa82e91..ed7c87b 100644 --- a/packages/web-api-hooks/src/useSize.ts +++ b/packages/web-api-hooks/src/useSize.ts @@ -25,10 +25,10 @@ export default function useSize( const [size, setSize] = useState>([0, 0]); useEffect(() => { - const CustomResizeObserver = ResizeObserverOverride || ResizeObserver; - if (!CustomResizeObserver || !ref.current) return undefined; + const ResizeObserver = ResizeObserverOverride || window.ResizeObserver; + if (!ResizeObserver || !ref.current) return undefined; - const observer = new CustomResizeObserver(([entry]) => { + const observer = new ResizeObserver(([entry]) => { const { width, height } = entry.contentRect; setSize([width, height]); });