JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/phaser/2.0.3/phaser.min.js"></script>

JavaScript

var game = new Phaser.Game(480, 360, Phaser.AUTO, '');

state1 = {
	create: function() {
		text = game.add.text(game.world.centerX, game.world.centerY, "State 1");
		text.anchor.set(0.5);
		text.align = 'center';
		text.font = 'Arial';
		text.fontWeight = 'bold';
		text.fontSize = 70;
		text.fill = '#ffffff';
		c = 0;
		
		game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR).onUp.add(function() {
			console.log('SPACE! - ' + (++c));
		});
		
		game.input.keyboard.addKey(Phaser.Keyboard.ENTER).onUp.add(function() {
			game.state.start('state2');
		});
	}
}

state2 = {
	create: function() {
		text = game.add.text(game.world.centerX, game.world.centerY, "State 2");
		text.anchor.set(0.5);
		text.align = 'center';
		text.font = 'Arial';
		text.fontWeight = 'bold';
		text.fontSize = 70;
		text.fill = '#ffffff';
	}
}

game.state.add('state1', state1);
game.state.add('state2', state2);

game.state.start('state1');