diff --git a/src/hooks/dom/useScrollHeight.ts b/src/hooks/dom/useScrollHeight.ts index 80596fec..48bf7f4d 100644 --- a/src/hooks/dom/useScrollHeight.ts +++ b/src/hooks/dom/useScrollHeight.ts @@ -1,5 +1,3 @@ -import { useEffect, useState } from 'react'; - const getHeight = () => { if (typeof document === 'undefined') { return 0; @@ -16,20 +14,4 @@ const getHeight = () => { html.offsetHeight ); }; -export const useScrollHeight = () => { - const [scrollHeight, setScrollHeight] = useState(getHeight()); - - useEffect(() => { - const measure = () => setScrollHeight(getHeight()); - - window.addEventListener('scroll', measure); - window.addEventListener('resize', measure); - - return () => { - window.removeEventListener('scroll', measure); - window.removeEventListener('resize', measure); - }; - }, []); - - return scrollHeight; -}; +export const useScrollHeight = () => getHeight();