# @johanbook/react-canvas

> ![](https://img.shields.io/travis/johanbook/react-canvas) ![](https://img.shields.io/npm/v/@johanbook/react-canvas)

Latest version **0.0.3** (published 2020-11-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install @johanbook/react-canvas
pnpm add @johanbook/react-canvas
yarn add @johanbook/react-canvas
bun add @johanbook/react-canvas
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2020-11-01 |
| First published | 2020-10-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Johan Book |
| Maintainers | johanbook |

## Links

- npm: https://www.npmjs.com/package/@johanbook/react-canvas
- Repository: https://github.com/johanbook/react-canvas
- Homepage: https://johanbook.github.io/react-canvas
- Issues: https://github.com/johanbook/react-canvas/issues
- npm.io page: https://npm.io/package/@johanbook/react-canvas

## Dependencies (1)

- [typescript](https://npm.io/package/typescript.md) ^4.0.3

## Recent versions

- 0.0.3 (latest) — 2020-11-01
- 0.0.2 — 2020-10-31
- 0.0.1 — 2020-10-27

## README

# @johanbook/react-canvas

![](https://img.shields.io/travis/johanbook/react-canvas)
![](https://img.shields.io/npm/v/@johanbook/react-canvas)

This library aims to make it easier to draw on HTML canvases.

## Install

Install it using

```sh
npm install @johanbook/react-canvas
```

## Basic usage

We can create a simple wave as

```jsx
import Canvas from "@johanbook/react-canvas";

const NUM = 100;
const items = [];
for(let idx = 0; idx < NUM; idx++){
  items.push({x: idx/NUM, y: 0})
}

const handleUpdateItem = (item, t) => {
  item.y = Math.sin(item.x*8 +t-0.5)/2 + 0.5;
}

function Component() {
  return (<Canvas
    items={items}
    height={100}
    onUpdateItem={handleUpdateItem}
  />);
```

---
_Source: https://npm.io/package/@johanbook/react-canvas · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
