npm install --save react-image-and-background-image-fadeor
yarn add react-image-and-background-image-fadeNote here that all unknown props like alt and title are passed through to the resulting img element.
import { Image } from "react-image-and-background-image-fade";
class Example extends Component {
render() {
return (
<Image
src="https://example.com/neon_cat.jpg"
width="300px"
height="300px"
alt="flying cat"
title="Neon cat"
/>
);
}
}React Image and Background Image Fade comprises of 3 main components:
Image For preloading and fading in img elementsBackgroundImage For preloading and fading in background images of any element.ImageLoader For creating your own implementation for image loading.