# use-image
**Repository Path**: mirrors_konvajs/use-image
## Basic Information
- **Project Name**: use-image
- **Description**: Custom React Hook for loading images
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-09
- **Last Updated**: 2026-05-23
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# useImage React Hook
Custom React Hook for loading images. It loads passed `url` and creates DOM image with such `src`.
Useful for canvas application like `react-konva`.
[Open image demo](https://konvajs.org/docs/react/Images.html)
## Install
```bash
npm install use-image
```
## Usage
```js
import React from 'react';
import { Image } from 'react-konva';
import useImage from 'use-image';
const url = 'https://konvajs.github.io/assets/yoda.jpg';
function SimpleApp() {
const [image] = useImage(url);
// "image" will be DOM image element or undefined
return (
);
}
function ComplexApp() {
// set crossOrigin of image as second argument, set referrerpolicy as third argument
const [image, status] = useImage(url, 'anonymous', 'origin');
// status can be "loading", "loaded" or "failed"
return (
);
}
```
## License
MIT