Last active
March 4, 2019 10:56
-
-
Save PabloRegen/5c7b0b6a30b3d37a60a978946cf0b5d7 to your computer and use it in GitHub Desktop.
The render method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends Component { | |
// All previous methods ... | |
render() { | |
const { boardStatus, isGameRunning, generation, speed } = this.state; | |
return ( | |
<div> | |
<h1>Game of Life</h1> | |
<BoardGrid boardStatus={boardStatus} onToggleCellStatus={this.handleToggleCellStatus} /> | |
<div className='flexRow upperControls' | |
<span> | |
{'+ '} | |
<Slider speed={speed} onSpeedChange={this.handleSpeedChange} /> | |
{' -'} | |
</span> | |
{`Generation: ${generation}`} | |
</div> | |
<div className='flexRow lowerControls'> | |
{this.runStopButton()} | |
<button type='button' disabled={isGameRunning} onClick={this.handleStep}>Step</button> | |
<button type='button' onClick={this.handleClearBoard}>Clear Board</button> | |
<button type='button' onClick={this.handleNewBoard}>New Board</button> | |
</div> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment