diff options
| author | 2024-09-11 17:17:14 +0100 | |
|---|---|---|
| committer | 2024-09-11 17:17:14 +0100 | |
| commit | 5ccaae56404df5f8dc16b3eebe17fe1d88d62d5f (patch) | |
| tree | d9bc4b2ffe8574be18d0ad80664d063f98be3556 /thallium-frontend/src/utils/hooks.ts | |
| parent | Type corrections (diff) | |
Fix eslint
Diffstat (limited to 'thallium-frontend/src/utils/hooks.ts')
| -rw-r--r-- | thallium-frontend/src/utils/hooks.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/thallium-frontend/src/utils/hooks.ts b/thallium-frontend/src/utils/hooks.ts index 997f274..337ccf2 100644 --- a/thallium-frontend/src/utils/hooks.ts +++ b/thallium-frontend/src/utils/hooks.ts @@ -2,16 +2,16 @@ import { useState, useEffect } from "react"; import { type RefObject } from "react"; export function useVisible(ref: RefObject<HTMLElement>) { - const [isVisible, setVisible] = useState(false) + const [isVisible, setVisible] = useState(false); useEffect(() => { const observer = new IntersectionObserver( - ([entry]) => setVisible(entry.isIntersecting) - ) + ([entry]) => { setVisible(entry.isIntersecting); } + ); if (ref.current) - observer.observe(ref.current) - return () => observer.disconnect() - }, []) + observer.observe(ref.current); + return () => { observer.disconnect(); }; + }, [ref]); - return isVisible + return isVisible; } |