UNPKG

mh-rn-component

Version:

29 lines (25 loc) 616 B
import React, { useEffect, useState } from 'react'; const LazyRender = _ref => { let { show, children, lazyRender, ...rest } = _ref; const [_c, set_c] = useState(children); const durationTime = () => { if (show) { set_c(children); const tt = setTimeout(() => { set_c(null); clearTimeout(tt); }, rest.duration); } }; useEffect(() => { durationTime(); }, [show]); return /*#__PURE__*/React.createElement(React.Fragment, null, lazyRender ? show ? children : _c : children); }; export default LazyRender; //# sourceMappingURL=index.js.map