Skip to content

Instantly share code, notes, and snippets.

@morganney
Last active January 8, 2017 04:58
Show Gist options
  • Save morganney/3b8f3e4d9af3bd645f6b3662ccfea5da to your computer and use it in GitHub Desktop.
Save morganney/3b8f3e4d9af3bd645f6b3662ccfea5da to your computer and use it in GitHub Desktop.
import React from 'react'
import ReactDOM from 'react-dom'
import Title from './components/title'
import GridSizeSelector from './components/grid-size-selector'
import GameOfLife from './components/game-of-life'
class App extends React.Component {
constructor (props) {
super(props)
this.handleGridSizeChange = this.handleGridSizeChange.bind(this)
}
handleGridSizeChange (size) {
this.refs.gol.handleGridSizeChange(size)
}
render () {
return (
<div>
<Title />
<GridSizeSelector onGridSizeChange={this.handleGridSizeChange} />
<GameOfLife ref='gol' />
</div>
)
}
}
export default {
init (selector) {
ReactDOM.render(<App />, document.getElementById(selector))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment