Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 532 Bytes

Img.md

File metadata and controls

20 lines (14 loc) · 532 Bytes

<Img>

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 loaded
  • renderError(img, props) — render prop used to render if image fails to load
  • $ref — passed as ref to the underlying <img>

Usage

import {Img} from 'libreact/lib/Img';

<Img
  src="..."
  renderLoad={(img) => <div>Loading...{img}</div>}
  renderError={() => <div>Error happened</div>}
/>