An open API service indexing awesome lists of open source software.

https://github.com/potatoparser/preact-lazyload

Dead simple lazy loading in preact.
https://github.com/potatoparser/preact-lazyload

Last synced: about 1 year ago
JSON representation

Dead simple lazy loading in preact.

Awesome Lists containing this project

README

          

# preact-lazyload
> Dead simple lazy loading in preact.

### Installation
```
npm i preact-lazyload
```

### Usage
```jsx
import { h } from 'preact';

import LazyLoad from 'preact-lazyload';

const App = () => (

Hello World!

);

render(, document.body);
```

Looking for lazy loading images? Although `preact-lazyload` supports all elements, it's better to use [`preact-lazyimage`](https://www.npmjs.com/package/preact-lazyimage)

### Multiple elements
```jsx
import { h } from 'preact';

import LazyLoad from 'preact-lazyload';

const App = () => (


Hello
World!


);

render(, document.body);
```

### Images
```jsx
import { h } from 'preact';

import LazyLoad from 'preact-lazyload';

const App = () => (


{
Array(120).fill("./icon.png").map(img => {
return (



);
})
}

);

render(, document.body);
```