A wrapper around <img>
element that accepts all <img>
props and adds these additional ones:
renderLoad(img, props)
— render prop used to render content while image is being loadedrenderError(img, props)
— render prop used to render if image fails to load$ref
— passed asref
to the underlying<img>
import {Img} from 'libreact/lib/Img';
<Img
src="..."
renderLoad={(img) => <div>Loading...{img}</div>}
renderError={() => <div>Error happened</div>}
/>