JSFiddle - React, Tailwind, and code Playground

by powerMugen

HTML

<canvas width="600" height="600" id="foo"></canvas>

<img id="canvasImg"  width="600" height="600"  alt="I am an image" src="" />

JavaScript

var canvas = document.getElementById("foo");
var ctx = canvas.getContext("2d");

ctx.fillStyle = "#c8a";
ctx.fillRect(0, 0, 100, 100);
ctx.fillStyle = "#225";
ctx.fillRect(100, 100, 100, 100);

var img = new Image();
    img.src =...