1.0.3 • Published 3 years ago

react-hook-image v1.0.3

Weekly downloads
42
License
MIT
Repository
github
Last release
3 years ago

Install

Yarn
yarn add react-hook-image
NPM
npm i react-hook-image

Usage

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

ArgumentsRequired?
urlYes
crossOriginNo

License

Licensed under the MIT License