Skip to main content

Hooks

Browse all available hooks in Hookstorm, organized by category.

State & UI

HookDescription
useToggleToggle a boolean with an optional forced value
useCounterIncrement, decrement, and reset a counter
usePreviousAccess the previous value of any state or prop
useDebounceDelay a value update until input settles

DOM & Browser

HookDescription
useWindowSizeTrack current window width and height
useScrollPositionRead the current scroll position
useMousePositionTrack cursor position in real time
useHoverDetect hover state on any element
useClickOutsideDetect clicks outside a referenced element
useDocumentTitleDynamically update the browser tab title
useLockScrollPrevent or restore page scroll
useKeyPressDetect when a specific key is held down
useEventListenerAttach an event listener to window or any element
useMediaQueryTrack whether a CSS media query matches
useIntersectionObserverDetect when an element enters or leaves the viewport
useResizeObserverTrack the dimensions of a DOM element

Storage

HookDescription
useLocalStoragelocalStorage with a React state interface
useSessionStoragesessionStorage with a React state interface
useCookieRead, write, and remove cookies

Network & Device

HookDescription
useOnlineStatusDetect online / offline status
useGeoLocationRequest and track user geolocation
usePageVisibilityKnow when the user switches away from the tab
usePrefersThemeRead the OS prefers-color-scheme setting

Timers & Async

HookDescription
useCountdownCountdown timer with start, stop, and reset
useIdleDetect inactivity after a configurable timeout
useAsyncManage async function lifecycle with loading, data, and error
useIntervalDeclarative setInterval with pause support
useTimeoutDeclarative setTimeout with reset and clear
useMountedRef-based mount guard for safe async state updates