0.0.12 • Published 2 years ago

@montagejs/react-lazy-load-image v0.0.12

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

React-Lazy-Load-Image

react image lazy loading component with built-in image preloading capabilities.

Usage

$ npm i @montagejs/react-lazy-load-image --save
import { FC } from 'react';
import ReactLazyLoadImage, { ReactLazyLoadImageProvider } from '@montagejs/react-lazy-load-image';

const ReactLazyLoadImageDemo: FC = () => {

    return (
        <ReactLazyLoadImageProvider
            getPopupContainer={() => document.querySelector('.img-container')}
        >
            <div className="img-container" >
                <ReactLazyLoadImage
                    src={
                        'xxxx'
                    }
                />
            </div>
        </ReactLazyLoadImageProvider>
    );
};

export default ReactLazyLoadImageDemo;

API

Main parameter configuration:

ReactLazyLoadImageProvider

propsdesctypedefaultversion
getPopupContainerA container that listens to viewport scrolling() => HTMLElement() => document.documentContent>0.0.4
preloadWhether to enable preloadingboolean | { src: string; }false>0.0.4
disabledLoadingWhether to disable native loadingbooleanfalse>0.0.4

ReactLazyLoadImage

Props is consistent with native img.

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago