diff options
author | 2024-09-11 17:23:18 +0100 | |
---|---|---|
committer | 2024-09-11 17:23:18 +0100 | |
commit | 2e465735897c828a2f5c81810183a69faaac090d (patch) | |
tree | c4741fe83e9ac470e7daf10fe919e68cc4770db8 | |
parent | Fix eslint (diff) |
Spacing
-rw-r--r-- | thallium-frontend/src/utils/hooks.ts | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/thallium-frontend/src/utils/hooks.ts b/thallium-frontend/src/utils/hooks.ts index 337ccf2..a98cfb3 100644 --- a/thallium-frontend/src/utils/hooks.ts +++ b/thallium-frontend/src/utils/hooks.ts @@ -8,8 +8,10 @@ export function useVisible(ref: RefObject<HTMLElement>) { const observer = new IntersectionObserver( ([entry]) => { setVisible(entry.isIntersecting); } ); + if (ref.current) observer.observe(ref.current); + return () => { observer.disconnect(); }; }, [ref]); |