Hooks
useInterval()

useInterval()

It uses the setInterval (opens in a new tab) method to repeatedly call a function or executes a code snippet, with a fixed time delay between each call.

Usage

import { useInterval } from '@norr/hooks';
 
const Component = () => {
  const delay = 1000;
 
  useInterval(() => {
    console.log(
      'This will be logged every second until you unmount the component.',
    );
  }, delay);
 
  return null;
};