Display a placeholder image while the real image loads.
npm install --save react-background-imageimportReactfrom'react';importBackgroundImagefrom'react-background-image';importplaceholderfrom'./images/small.jpg';importhdImagefrom'./images/large.jpg';exportdefaultfunctionApp(){return(<divclassName='main'><BackgroundImageplaceholder={placeholder}src={hdImage}className='myCustomClass'{...otherProps}><pclassName='some-class'>Other element</p><OtherReactComponent/></BackgroundImage></div>);}| Prop | Type | Notes |
|---|---|---|
| src | String | HD image to load |
| placeholder | String | Placeholder image to be immediately displayed |
| className | String | Optional custom css class |
https://jonatanramhoj.github.io/react-background-image/
MIT © jonatanramhoj