π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
import { useState, useEffect } from 'react';
export function useHasScroll(
ref: React.RefObject<HTMLElement | null>,
) {
const [hasScroll, setHasScroll] = useState(false);
useEffect(() => {
const el = ref.current;
if (!el) return;
const check = () => setHasScroll(el.scrollHeight > el.clientHeight);
check();
const observer = new MutationObserver(check);
observer.observe(el, { childList: true, subtree: true });
return () => observer.disconnect();
}, [ref]);
return hasScroll;
}