Skip to content

Migggz/react-hook-image

Repository files navigation

useImage
Minimal React Hook to load images!

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

Arguments Required?
url Yes
crossOrigin No

License

Licensed under the MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published