'use strict';

var React = require('react');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);

const Counting = (props) => {
  const { stop, interval = 1e3, render } = props;
  const [, setState] = React.useState(true);
  React.useEffect(() => {
    if (stop)
      return;
    const timer = setInterval(() => {
      setState((state) => !state);
    }, interval);
    return () => {
      clearInterval(timer);
    };
  }, [stop, interval]);
  return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, render());
};
var Counting$1 = Counting;

module.exports = Counting$1;
