react-lazy-viewport

Load your component based on viewport.

Usage no npm install needed!

<script type="module">
  import reactLazyViewport from 'https://cdn.skypack.dev/react-lazy-viewport';
</script>

README

React Lazy Viewport

PRs Welcome npm version Bundlephobia Bundlephobia

Load your React Component based on viewport, this library using Intersection Observer if your app targeting to not modern browser please adding this Polyfill.

Features

  • Type safe
  • Preload component
  • SSR Support

Instalation

$ yarn add react-lazy-viewport
$ npm i react-lazy-viewport

Demo

We assume we have some code like this.
example code
and then if you open the dev tools, the file will be loaded based on viewport example code

Contribute & Help

  • Fork and send Pull Requests are welcome
  • Submit an issues
  • A new feature requests

License

This library is MIT licensed