A smart img component for React. Demo
npm install react-smart-image
This package provides an enhanced IMG component, allowing to display a placeholder whilst your image loads and a fallback image if it fails loading.
import React from 'react';
import { Img } from 'react-smart-image';
class MyImage extends React.Component {
render() {
return (
<Img src='/my_wanted_image.png' srcFallback='/my_fallback_image.png' />
)
}
}
That's it.
Img: An enhanced Img component DivBG: A DIV component rendering a vertically + horizontally centered image ABg: Like DivBG, with an A component