JSFiddle - React, Tailwind, and code Playground

HTML

<canvas id="canvas" class="canvas" width="300px" height="300px" style="border: 1px solid #000; margin-top: 20px;">
</canvas>
<script>
        window.onload = function()
        {
            var canvas = document.getElementById("canvas");
            addEventListener("mousedown", drawCircle)
        }

        function drawCircle(event) 
        {
            var canvas = document.getElementById("canvas");
            var ctx = canvas.getContext("2d");

            x = event.offsetX
            y = event.offsetY

            ctx.fillStyle = "red";
            ctx.beginPath();
            ctx.arc(x, y, 20, 0, 2 * Math.PI);
            ctx.stroke();
            ctx.fill()
        } 
</script>