# use-progressive-image

> Lazy load images

Latest version **1.0.1** (published 2020-04-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-progressive-image
pnpm add use-progressive-image
yarn add use-progressive-image
bun add use-progressive-image
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-04-03 |
| First published | 2020-04-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Oscar Fernández |
| Maintainers | oscarfernandez |

## Links

- npm: https://www.npmjs.com/package/use-progressive-image
- Repository: https://github.com/OscarFCN/use-progressive-image
- Homepage: https://github.com/OscarFCN/use-progressive-image#readme
- Issues: https://github.com/OscarFCN/use-progressive-image/issues
- npm.io page: https://npm.io/package/use-progressive-image

## Recent versions

- 1.0.1 (latest) — 2020-04-03
- 1.0.0 — 2020-04-03

## README

# use-progressive-image

> Lazy load images

[![NPM](https://img.shields.io/npm/v/use-progressive-image.svg)](https://www.npmjs.com/package/use-progressive-image) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save use-progressive-image
yarn add use-progressive-image
```

## Usage

```jsx
import React from 'react';
import Header from './Header';
import {useProgressiveImage} from 'use-progressive-image';

const Cover = ({ image, className, isInverted, backgroundImage, children }) => {
  const [loaded, placeholder] = useProgressiveImage(backgroundImage, image);
  const imageStyle = backgroundImage
    ? { backgroundImage: `url(${loaded || placeholder})` }
    : null;
  return (
    <div className={`cover ${className ? className : ''}`} style={imageStyle}>
      <Header className={isInverted ? 'header--invert' : ''} />
      <h1 className='cover__text'>{children}</h1>
      {image && (
        <div className='cover__image'>
          <img src={image} alt='cover' />
        </div>
      )}
    </div>
  );
};

export default Cover;
```

## License

MIT © [Oscar Fernández](https://github.com/Oscar Fernández)

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