@nothing.app/use-image
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Installation

yarn add @nothing.app/use-image

Usage

import React from "react";
import { Image } from "react-konva";
import useImage from "use-image";

const url =
  "https://bridged-service-static.s3-us-west-1.amazonaws.com/branding/bridged-logo-512.png";

function SimpleApp() {
  const [image] = useImage(url);

  // "image" will DOM image element or undefined

  return <Image image={image} />;
}

function ComplexApp() {
  // set crossOrigin of image as second argument
  const [image, status] = useImage(url, "Anonymous");

  // status can be "loading", "loaded" or "failed"

  return <Image image={image} />;
}

Related

For Loading CORS Images, you can use https://cors.bridged.cc

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @nothing.app/use-image

      Homepage

      nothing.app

      Weekly Downloads

      2

      Version

      1.0.0

      License

      MIT

      Unpacked Size

      2.75 kB

      Total Files

      5

      Last publish

      Collaborators

      • softmarshmallow