JSFiddle - React, Tailwind, and code Playground

HTML

<canvas id="gameCanvas" width="400" height="400"
style="border:1px solid #000000;">
</canvas>

JavaScript

(function () {
    var game = {
        init: function(){
            this.canvas = document.getElementById("gameCanvas");
            
            this.start();
        },
        start: function(){
            var g = this;
            window.setInterval( function(){ g.tick.call(g);}, 100);
        },    
        tick: function(){
            var ctx = this.canvas.getContext("2d");
            ctx.fillStyle = "#FF0000";
            ctx.fillRect(0,0,150,75);
        }
    };
    
    game.init();
})();