Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Last active January 8, 2019 17:19
Show Gist options
  • Save ajcrites/22a71696fc08383de440edb7747fa4cf to your computer and use it in GitHub Desktop.
Save ajcrites/22a71696fc08383de440edb7747fa4cf to your computer and use it in GitHub Desktop.
export const TimesTable = props => {
const canvasRef = useRef(null);
const redraw = () => {
const canvas = canvasRef.current;
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
};
let viz;
if (canvasRef.current) {
const ctx = canvasRef.current.getContext('2d');
viz = <Viz ctx={ctx} {...props} />;
}
return (
<canvas ref={canvasRef}>
{viz}
<canvas>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment