source: imaps-frontend/node_modules/react-use/esm/useInterval.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 532 bytes
Line 
1import { useEffect, useRef } from 'react';
2var useInterval = function (callback, delay) {
3 var savedCallback = useRef(function () { });
4 useEffect(function () {
5 savedCallback.current = callback;
6 });
7 useEffect(function () {
8 if (delay !== null) {
9 var interval_1 = setInterval(function () { return savedCallback.current(); }, delay || 0);
10 return function () { return clearInterval(interval_1); };
11 }
12 return undefined;
13 }, [delay]);
14};
15export default useInterval;
Note: See TracBrowser for help on using the repository browser.