1.0.3 • Published 2 years ago

react-simple-lazy-loading v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

react-simple-lazy-loading

easy way to make lazy loading images in your website

  npm i react-simple-lazy-loading

Usage

import useLazyLoading from "react-simple-lazy-loading" ;

function App() {
  const loadingRef = useRef(null);

  const options={
    refTriger:loadingRef,
    rootMargin:"0px",
    threshold:1.0,
    initPage:1,
    url:"<enter the fetch data url>",
    headers:{
      'content-type': "application/json",
    }
  }

  const { data, loading, nextPage } = useLazyLoading(options);

  return (
    <div>
      <div className='scrolling'>
        {data?.map((item, i) => <img key={i} src={item.src}></img>)}
      </div>
      <div ref={loadingRef}>trigger</div>
    </div>
  )
}
1.0.2

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago