A basic useInterval hook for React. Works just like you would expect setInterval to work.
npm install --save react-use-interval-hook
import React, { useState } from "react";
import { useInterval } from "react-use-interval-hook";
const ExampleCounter = () => {
const [count, setCount] = useState(0);
useInterval(() => {
setCount(count + 1);
}, 1000);
return <div>Count is: {count}</div>;
};
MIT © bnzone