JSFiddle - React, Tailwind, and code Playground

HTML

<canvas id="canvas" width="150" height="150"></canvas>

JavaScript

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

ctx.globalCompositeOperation = 'destination-atop';
ctx.rect(20,20,100,100);
ctx.fill();
ctx.stroke();