JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <canvas id="canvas"></canvas>

JavaScript

$(function() {
      var canvas = $('#canvas').get(0);
      var ctx = canvas.getContext('2d');
      var w = h = canvas.width = canvas.height = 300;

      ctx.fillStyle = '#000';
      ctx.fillRect(0, 0, w, h);

      canvas.addEventListener('mousemove', function(e) {
        var x = e.pageX - canvas.offsetLeft;
        var y = e.pageY - canvas.offsetTop;
        var str = 'X : ' + x + ', ' + 'Y :' + y;

        ctx.fillStyle = '#000';
        ctx.fillRect(0, 0, w, h);
        ctx.fillStyle = '#222';
        ctx.fillRect(x + 10, y + 10, 80, 25);
        ctx.fillStyle = '#0099f9';
        ctx.font = 'bold 20px verdana';
        ctx.fillText(str, x + 20, y + 30, 60);

      }, 0);
    });