1.0.3 • Published 5 years ago
react-hook-image v1.0.3
Install
Yarn
yarn add react-hook-imageNPM
npm i react-hook-imageUsage
import useImage from "react-hook-image";
export default function ImageComponent({ imageUrl }) {
const { src, status } = useImage(imageUrl, "Anonymous");
return status === "loading" ? <div>Loading ...</div> : <img src={src} alt="alt text" />
});Hook status: loading, success, failed
| Arguments | Required? |
|---|---|
| url | Yes |
| crossOrigin | No |
License
Licensed under the MIT License