JSFiddle - React, Tailwind, and code Playground

by codef0rmer

HTML

<svg id='svg' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400">
</svg>

JavaScript

/*
 * HTML5 Session SVG Demo
 */

function drawPixel(SVGRoot, x, y) {
    var pixel = document.createElementNS("http://www.w3.org/2000/svg", "rect");

    pixel.setAttribute('style', "fill: black");
    pixel.setAttribute('x', x);
    pixel.setAttribute('y', y);
    pixel.setAttribute('width', 4);
    pixel.setAttribute('height', 4);
    SVGRoot.appendChild(pixel);
}
$(function () {
    $("#svg").mousemove(function(d){
        drawPixel(document.getElementById('svg'), d.pageX - this.offsetLeft, d.pageY - this.offsetTop);  
    });
});