JSFiddle - React, Tailwind, and code Playground
HTML
<canvas id="rectangle"></canvas>
JavaScript
function draw () {
var canvas = document.getElementById('rectangle');
var ctx = canvas.getContext('2d');
ctx.save();
ctx.lineWidth = 30;
ctx.fillStyle = "black";
ctx.fillRect(40,40,100,100);
ctx.strokeStyle = "red";
ctx.strokeRect(40,40,100,100);
ctx.restore();
}
draw();