A custom React hook that wraps setInterval
npm install react-useinterval 
``sh`
$ npm install --save react-useinterval
useInterval(callback, delay, ...args)
| Property | Type | Required | Description |
|----------|------| -------- |-------------|
callback | Function | Yes | A function to be executed every delay milliseconds.Number
delay | , undefined, or null | No | The time, in milliseconds, that the timer should delay in between executions of the specified function. Note: If undefined or null is passed, the interval will be paused. |Any
| ...args | | No | Additional arguments which are passed through to the function specified by callback. |
This creates a counter that counts up by five every second.
`js
import React, { useState } from 'react';
import useInterval from 'react-useinterval';
function Counter() {
let [count, setCount] = useState(0);
const increaseCount = amount => {
setCount(count + amount);
};
useInterval(increaseCount, 1000, 5);
return