use p5 with hooks
# with npm
npm install --save @gen/react-use-p5
# with yarn
yarn add @gen/react-use-p5
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} />
}
MIT © zenoplex