lazy-child
Version:
React component that renders its child when it enters the viewport
3 lines (2 loc) • 669 B
JavaScript
import r,{useState as e,Fragment as n}from"react";import{useIntersectionChange as t}from"react-peekaboo";function o(){return(o=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r}).apply(this,arguments)}export default function(l){var a=l.children,c=l.renderPlaceholder,i=function(r,e){if(null==r)return{};var n,t,o={},l=Object.keys(r);for(t=0;t<l.length;t++)e.indexOf(n=l[t])>=0||(o[n]=r[n]);return o}(l,["children","renderPlaceholder"]),f=e(!1),u=f[0],d=t(f[1],o({enabled:!u},i));return r.createElement(n,null,u?a:c(d))}
//# sourceMappingURL=index.esm.js.map