React self-correcting interval hook for precision timing, augmented by management methods
- Self-correcting (explanation)
- Manageable (start, stop, isActive)
- Thoroughly tested
yarn add react-interval-hook
or
npm install --save react-interval-hook
import React from 'react'; // No longer necessary in newer React versions
import { useInterval } from 'react-interval-hook';
export const Example = () => {
useInterval(() => {
console.log('I am called every second');
});
return null;
};
Full documentation can be found here
If you like my work, consider making a donation through Github Sponsors.
MIT © minwork