diff --git a/docs/src/pages/hooks/use-resize-observer.mdx b/docs/src/pages/hooks/use-resize-observer.mdx index 974f5b4e787..682a6c0d240 100644 --- a/docs/src/pages/hooks/use-resize-observer.mdx +++ b/docs/src/pages/hooks/use-resize-observer.mdx @@ -31,7 +31,7 @@ See also [use-element-size](https://mantine.dev/hooks/use-element-size/) hook in function useResizeObserver( options?: ResizeObserverOptions ): [ - MutableRefObject, + RefObject, { x: number; y: number; diff --git a/packages/@mantine/hooks/src/use-resize-observer/use-resize-observer.ts b/packages/@mantine/hooks/src/use-resize-observer/use-resize-observer.ts index 8f61beff229..d2204a24186 100644 --- a/packages/@mantine/hooks/src/use-resize-observer/use-resize-observer.ts +++ b/packages/@mantine/hooks/src/use-resize-observer/use-resize-observer.ts @@ -15,7 +15,7 @@ const defaultState: ObserverRect = { export function useResizeObserver(options?: ResizeObserverOptions) { const frameID = useRef(0); - const ref = useRef(); + const ref = useRef(null); const [rect, setRect] = useState(defaultState); @@ -53,7 +53,7 @@ export function useResizeObserver(options?: ResizeO }; }, [ref.current]); - return [ref as any, rect] as const; + return [ref, rect] as const; } export function useElementSize(options?: ResizeObserverOptions) {