/** * A hook that provides a way to run a function at regular intervals. * Automatically handles cleanup and can be paused/resumed. * * @param callback - The function to call on each interval * @param delay - The delay between calls in milliseconds (null to pause) * * @example * ```tsx * const [count, setCount] = useState(0) * const [isRunning, setIsRunning] = useState(true) * * useInterval( * () => setCount(c => c + 1), * isRunning ? 1000 : null * ) * * return ( *