import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
useThrottledScroll
A reusable hook that attaches a scroll event listener to window with requestAnimationFrame-based throttling. Ensures the callback fires at most once per animation frame (~60 fps), making it ideal for scroll-driven UI updates such as sticky headers, progress indicators, and parallax effects.
Source: template/hooks/use-throttled-scroll.ts
Signature
function useThrottledScroll(
callback: () => void,
enabled?: boolean
): void;