lazy load img with intersectionObserver
npm install --save lazy-load-kle
import React, { Component } from 'react'
import{ LazyLoad , LazyEarly } from 'lazy-load-kle'
class Example extends Component {
render() {
return <LazyLoad src='link of img' alt='alt' placeholder='link placeholder image' className='add some class for img'/>
<!-- Load when image in screen -->
<LazyEarly src='link of img' alt='alt' placeholder='link placeholder image' className='add some class for img' early={value(2300)}/>
<!-- Load when image margin = early (default = 200px) -->
}
}
MIT © phamqi