Skip to content

Lazy loading components in React using the IntersectionObserver.

License

Notifications You must be signed in to change notification settings

klaatucarpenter/react-lazyload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

react-lazyload

Lazy load your Components with simple hook and browser API.

Why

Component will only be mounted when it's visible in viewport, before that a placeholder will be rendered.

No additional DOM Nodes.
No additional parameters.

Usage

const LazyLoad = (props) => {
    const [isIntersecting, ref] = useIntersection();
    return (
        <div ref={ref}>
            {isIntersecting ? props.children : null}
        </div>
    )
}

About

Lazy loading components in React using the IntersectionObserver.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published