JSFiddle - React, Tailwind, and code Playground

HTML

<canvas width="300" height="300"></canvas>

CSS

canvas {
  border: 1px solid #000;
}

JavaScript

var ctx = document.querySelector('canvas').getContext('2d');

var img = new Image();
img.addEventListener('load', function () {
	ctx.drawImage(img, 0, 0);
});
img.src = 'https://placekitten.com/g/300/300';