JSFiddle - React, Tailwind, and code Playground
HTML
<canvas id="MyCan" ></canvas>
CSS
#MyCan{
width: 500;
height: 500;
}
JavaScript
var can = document.getElementById('MyCan');
var ctx = can.getContext('2d');
can.width = 100;
can.hight = 100;
function drawRect( x, y, w, h, color ){
ctx.fillStyle = color || '#ff0000';
ctx.fillRect( x, y, w, h );
}
drawRect( 15, 15, 15, 15, '#ff0000' );