JSFiddle - React, Tailwind, and code Playground
HTML
<div style='position:absolute; background-color: blue; height: 50px; width:50px;'></div>
JavaScript
setInterval(function(){
$("div").stop(true,true).animate({left: 300}, 1000,
function(){ $(this).stop(true,true).animate({left: 0}, 1000);
});
}, 2000);