• Call function on a specified time interval

    Parameters

    • callback: (() => void)

      callback function to call on interval

        • (): void
        • Returns void

    • Optional delay: number

      delay for the interval in milliseconds

    Returns void

    Example

    // Prints "Hi" every 3 seconds
    useInterval(() => {
    console.log("Hi")
    }, 3000)