JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://github.com/photonstorm/phaser/releases/download/v2.4.8/phaser.js"></script>
<div id="testEnvironmentContainer">

</div>

JavaScript

testEnvironment = function() { };  
testEnvironment.prototype = {

  start: function() {
      this.game = new Phaser.Game({
        width: 400,
        height: 300,
        renderer: Phaser.CANVAS,
        parent: 'testEnvironmentContainer'
      });
      this.game.state.add('play', {
        preload: this.preloadGame.bind(this),
        create: this.createGame.bind(this),
        update: this.updateGame.bind(this)
      });

      this.game.state.start('play');
    },

    stop: function() {
      this.game.state.destroy();
    },

    preloadGame: function() {
      this.game.stage.backgroundColor = '#9ad3de';
      this.game.stage.disableVisibilityChange = true;
    },

    createGame: function() {
      this.game.physics.startSystem(Phaser.Physics.P2JS);
      this.game.physics.p2.setImpactEvents(true);
      this.game.physics.p2.gravity.y = 770;

      this.ballCollisionGroup = this.game.physics.p2.createCollisionGroup();
      this.wallCollisionGroup = this.game.physics.p2.createCollisionGroup();
      this.groundCollisionGroup = this.game.physics.p2.createCollisionGroup();

      this.game.physics.p2.updateBoundsCollisionGroup();

      this.worldMaterial = this.game.physics.p2.createMaterial('world');
      this.ballMaterial = this.game.physics.p2.createMaterial('ball');
      this.netBallDelimiterMaterial = this.game.physics.p2.createMaterial('netBallDelimiter');

      this.game.physics.p2.setWorldMaterial(this.worldMaterial);

      /**
       * Ball
       */
      this.createBall();

      /**
       * Contact materials
       */
      this.game.physics.p2.createContactMaterial(this.ballMaterial, this.worldMaterial, {
        restitution: 1
      });
      this.game.physics.p2.createContactMaterial(this.netBallDelimiterMaterial, this.ballMaterial, {
        restitution: 0,
        stiffness: 1e10000
      });

      this.loadLevel();

      this.spawnBall();
    },

    createBall: function() {
      /** @var {Phaser.Sprite} ball */
      this.ball...