Skip to content

zenoplex/react-use-p5

Repository files navigation

react-use-p5

use p5 with hooks

Node.js CI NPM JavaScript Style Guide

Install

# with npm
npm install --save @gen/react-use-p5

# with yarn
yarn add @gen/react-use-p5

Usage

import React, { Component } from 'react';
import { useP5 } from '@gen/react-use-p5';
import { sketch } from 'your-p5-sketch-file';

const Component = () => {
  const [setRef] = useP5(sketch);
  // Canvas will be rendered as child of div
  return <div ref={setRef} />
}

License

MIT © zenoplex