@tremendous/help
    Preparing search index...

    Function useInterval

    • Custom hook that sets up an interval to call a callback function at specified intervals.

      This hook takes a callback function and a delay in milliseconds, setting up an interval that calls the callback. The interval is cleared when the delay changes or the component is unmounted.

      Parameters

      • callback: () => void

        The function to be called at each interval.

      • delay: null | number

        The delay in milliseconds for the interval. Pass null to stop the interval.

      Returns void

      useInterval(() => {
      console.log('This will run every second');
      }, 1000);