JSFiddle - React, Tailwind, and code Playground

HTML

<div id="mydiv" style="position: absolute; left: 0; top: 0;">This should move with the mouse.</div>

JavaScript

window.onmousemove = function(event) {
    var div = document.getElementById("mydiv");
    div.style.left = event.clientX + 5 + "px";
    div.style.top = event.clientY + 5 + "px";
}