JSFiddle - React, Tailwind, and code Playground
by victorrseloy
HTML
<html>
<head>
</head>
<body onmousemove="lineDraw()">
<canvas id="myCanvas" width="640" height="480"/>
</body>
</html>
JavaScript
function lineDraw() {
var canvas=document.getElementById("myCanvas");
var context=canvas.getContext("2d");
//context.clearRect(0, 0, context.width,context.height);
context.canvas.width = context.canvas.width;
context.moveTo(0,0);
context.lineTo(event.clientX,event.clientY);
context.stroke();
}