npm install --save react-lazy-loading-image
import * as React from 'react'
import LazyImg from 'react-lazy-loading-image'
class Example extends React.Component {
render () {
return (
// Main Page init image
<img src={address}/>
// Use LazyImg Components for lazy loading img
<LazyImg src={"https://seonhyungjo.github.io/react-lazy-loading-image/"}/>
)
}
}
Image component working similar with standard img
tag and with the following props.
This is not General Image Component
Prop | Type | Required | Description |
---|---|---|---|
src |
string | ✓ | The image source |
id |
string | Element Id | |
className |
string | Element Class Name | |
alt |
string | Image alt | |
sizes |
any | Image default sizes | |
srcset |
string | Image srcset | |
style |
object | Element Inline Style | |
height |
number | Image Default height | |
width |
number | Image Default width | |
border |
string | Image Default border |
MIT © 🐭snyung