# react-image-to-lazyload

> about image react component

Latest version **2.1.3** (published 2020-10-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-image-to-lazyload
pnpm add react-image-to-lazyload
yarn add react-image-to-lazyload
bun add react-image-to-lazyload
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.1.3 |
| Published | 2020-10-22 |
| First published | 2020-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 29 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | andrew |
| Maintainers | andrewkz |
| Keywords | lazyload, react lazyload image, react ts hook lazyload image, react lazyload component, lazy |

## Links

- npm: https://www.npmjs.com/package/react-image-to-lazyload
- Repository: https://github.com/Andrewkz/react-image
- Issues: https://github.com/Andrewkz/react-image/issues
- npm.io page: https://npm.io/package/react-image-to-lazyload

## Dependencies (4)

- [react](https://npm.io/package/react.md) ^16.13.1
- [react-dom](https://npm.io/package/react-dom.md) ^16.13.1
- [normalize.css](https://npm.io/package/normalize.css.md) ^8.0.1
- [intersection-observer](https://npm.io/package/intersection-observer.md) ^0.10.0

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 2.1.3 (latest) — 2020-10-22
- 2.1.2 — 2020-10-22
- 2.0.2 — 2020-09-22
- 1.0.0 — 2020-06-23

## README

# react-image-to-lazyload

## 安装

npm install react-image-to-lazyload -D  
or  
yarn add react-image-to-lazyload -D

Example（LazyWrapper）:

```jsx
import * as React from 'react';
import { LazyWrapper } from 'react-image-to-lazyload';

<LazyWrapper placeholder={loading}>
	<img data-src={src} name="lazy" />
	<img data-src={src} name="lazy" />
	<img data-src={src} name="lazy" />
	<img data-src={src} name="lazy" />
	<img data-src={src} name="lazy" />
	<img data-src={src} name="lazy" />
</LazyWrapper>;
```

Example（LazyItem）:

```jsx
import * as React from 'react';
import { LazyItem } from 'react-image-to-lazyload';

<LazyItem placeholder={loading} url={src}></LazyItem>;
```

##### url (require: true)

LazyItem 组件的图片路径  
Type: `string`

##### data-src (require: true)

LazyWrapper 组件的图片路径  
Type: `string`

##### name (require: true)

LazyWrapper 组件的 name: lazy  
Type: `string`

##### placeholder?

默认图片  
Type: `string`

##### errorImage?

图片报错显示  
Type: `string`

##### onLoad?

LazyItem 组件图片加载后的回调
Type: `() => void`

##### options?

Type: `ObserverOptions`

IntersectionObserver options. https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#Intersection_observer_options

##### style?

Type: `React.CSSProperties`

##### className?

Type: `React.CSSProperties`

##### ...Element.props?

## License

[MIT License](/LICENSE)

---
_Source: https://npm.io/package/react-image-to-lazyload · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
