useInterval
A custom React hook to manage interval functionality.
Example
Loading...
Install
npx shadcn@latest add https://unlogg.com/r/use-interval.json
pnpm dlx shadcn@latest add https://unlogg.com/r/use-interval.json
bunx shadcn@latest add https://unlogg.com/r/use-interval.json
Notes
- Provides a simple way to manage interval functionality.
- Includes functions to set the interval duration and trigger the interval.
Examples
Use useInterval
to create a simple countdown timer that updates every second:
Loading...
API Reference
Parameters
Prop | Type | Default |
---|---|---|
delay | number | null | - |
callback | () => void | - |