JSFiddle - React, Tailwind, and code Playground

HTML

<div id="hero">
</div>

CSS

body{ 
    margin: 0px;
    padding; 0px;
}
#hero{
    position: absolute;
    background-color: #f00;
    width: 20px;
    height: 20px;
}

JavaScript

var kleur="#f00";
var w=0;
init();


function init()
{
    setInterval(gameloop,25);
}
function gameloop()
{
    var hero_variable=document.getElementById("hero");
	hero_variable.style.left=w+"px"; 
    w=w+2;
}