Shadcn.io is not affiliated with official shadcn/ui
React useTimeout Hook
React useTimeout hook for declarative setTimeout with auto-cleanup. Pass null to pause, callback refs for fresh state. TypeScript ready.
Schedule delayed callbacks the React way with useTimeout. Pass a callback and delay—the timeout runs once and cleans up automatically on unmount. Pass null as delay to pause or disable the timeout. Callback is stored in a ref so it always has access to fresh props/state without resetting the timer. Timer restarts when delay changes. Cleanup happens automatically on unmount or when delay becomes null. No memory leaks, no stale closures. Perfect for delayed UI updates, auto-dismiss notifications, debounced actions, redirect timers, or any one-shot delayed operation. SSR safe, works with Next.js.
React useTimeout Hook preview
Installation
Related Components
React useInterval Hook
Declarative setInterval
React useDebounceValue Hook
Debounce state values
React useDebounceCallback Hook
Debounce function calls
React useCountdown Hook
Countdown timer with controls
React useBoolean Hook
Boolean state with helpers
React useToggle Hook
Toggle between values
FAQ
Was this page helpful?
Sign in to leave feedback.