npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

reavas

v0.2.1

Published

React + Canvas utility

Readme

npm version

Reavas ⚛ + 🖼 (react + canvas )

This is a tiny react component that takes in the id of a <canvas> and provides you with setup() and paint() callbacks.

Demo

I built a fun particle canvas app using this library. Try it out here!

Install It

Simply grab it from npm using yarn or npm

$ yarn add reavas

$ npm install reavas

Use It

Firstly, create a new react class component and extend Reavas

import Reavas from 'reavas';

class Canvas extends Reavas {

}

Secondly, implement the setup() and paint() methods as you wish

import Reavas from 'reavas';

class Canvas extends Reavas {
  setup(canvas, context) {
    this.x = 100;
    this.y = 100;
  }

  paint(canvas, context) {
    context.beginPath();
    context.fillStyle = 'red';
    context.fillRect(this.x, this.y, 200, 100);
  }
}

Thirdly, create an html <canvas> element and give it an id. Then simply place your new component next to it and pass the id to the canvasId prop

import React from 'react'
import Canvas from './Canvas'; // the new component we just created

const SomeComponent = () => (
  <div>
    <canvas id="chicken"></canvas>
    <Canvas canvasId="chicken" />
  </div>
);

And that's it!

How it works

  • The component that extends Reavas won't actually render anything.

  • On mount it will find the canvas via the id then call the setup() function.

  • An internal loop that aims to achieve 60fps (using window.requestAnimationFrame) will be initiated and call the paint() function at each interval.

Props

  • canvasId: the id of the <canvas> element that you want to target. (required)

  • debug: when true, will print out loop info such as FPS to the console. (default: false)

Functions

As mentioned, there are two functions that your class can override setup() and paint(). You don't need to implement either, although, without the paint function you won't be doing much.

Both functions receive 2 arguments: canvas and context. The canvas arg is the actual html canvas element and can be used to get things such as the width and height of the canvas. The context arg is what you use to draw with.

Final words

Honestly, I don't know if this is actually useful to anyone, but if it is that's awesome! I'm by no means an expert at this sort of stuff so don't yell at me if the algorithms are wrong or something.

Thanks 🙃