react-hook-image
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published
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

/react-hook-image/

    Package Sidebar

    Install

    npm i react-hook-image

    Weekly Downloads

    92

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    4.31 kB

    Total Files

    5

    Last publish

    Collaborators

    • migggz