CODE:
var Game = createReactClass({
getInitalState() {
return {
start: false
}
},
handleStartClick() {
this.setState({
start: true
})
},
handleStopClick() {
this.setState({
start: false
})
},
render() {
return (
<div>
<h1>React.js Game of Life</h1>
<div className="buttons">
<button className="btn btn-danger" onClick={this.handelStopClick}>Stop</button>
<button className="btn btn-success" onClick={this.handelStartClick}>Start</button>
</div>
<Board start={this.state.start}/>
</div>
)
}
});
QUESTION:
Here is the error I get:
Cannot read property 'start' of null
If I change this.state.start to this.props.start, the error goes away but the board does not render.
How can I resolve this situation ?