"use strict";

exports.__esModule = true;
exports.default = void 0;

var _react = require("react");

function useLazyRender(show) {
  var _useState = (0, _react.useState)(false),
      inited = _useState[0],
      setInited = _useState[1];

  (0, _react.useEffect)(function () {
    if (show) {
      setInited(show);
    }
  }, [show]);
  return function (render) {
    return function () {
      return inited ? render() : null;
    };
  };
}

var _default = useLazyRender;
exports.default = _default;