aboutsummaryrefslogtreecommitdiffstats
path: root/thallium-frontend/src/utils/hooks.ts
diff options
context:
space:
mode:
Diffstat (limited to 'thallium-frontend/src/utils/hooks.ts')
-rw-r--r--thallium-frontend/src/utils/hooks.ts14
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;
}