# useInterval Execute the callback at regular intervals with the specified delay. Pauses execution if delayMs is set to `null`. ## Usage ```tsx import { useState } from 'react'; import { useInterval } from '@gilbarbara/hooks'; function Component() { const [count, setCount] = useState(0); const [delay, setDelay] = useState(1000); const [isRunning, setIsRunning] = useState(true); useInterval(() => setCount(prevCount => prevCount + 1), isRunning ? delay : null); return (
delay: setDelay(Number(event.target.value))} />

count: {count}

); } ``` ## Reference ```typescript useInterval(callback: () => void, delayMs: number | null = 100): void; ```