import { useEffect } from 'react'; export const useScrollToReference = ( ref?: React.RefObject, scroll?: boolean, onScrolled?: () => void, ) => { useEffect(() => { if (scroll) { ref?.current?.scrollIntoView({ behavior: 'instant', block: 'start' }); onScrolled?.(); } }, [onScrolled, ref, scroll]); };