JSFiddle - React, Tailwind, and code Playground

HTML

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

JavaScript

var div = document.getElementById('canvas');
var ctx = div.getContext('2d');
ctx.beginPath();
ctx.moveTo(0,0);
ctx.lineTo(400,200);
ctx.globalCompositeOperation = 'xor';
ctx.strokeStyle = 'black';
ctx.lineWidth = 2;
ctx.stroke();
ctx.closePath();

ctx.beginPath();
ctx.moveTo(0,0);
ctx.lineTo(400,200);
ctx.globalCompositeOperation = 'xor';
ctx.strokeStyle = 'black';
ctx.lineWidth = 2;
ctx.stroke();
ctx.closePath();