I am trying to make a counter but for some reason my code does not work and I really do not know what else to do. If I click on a button with value of 1, the H1 should automatically change.
When I inspect the page, I see the error that you can see in my screenshot
Is there anything wrong in my code perhaps that I cannot see?
<div id="app"></div>
<script type="text/babel">
var CounterChallenge = React.createClass({
getInitialState: function(){
return{
count: 0
}
},
incrementCount: function(value){
this.setState({
count: this.state.count + value
})
},
getDefaultProps: function(){
return{
valueOne: 1,
valueTwo: 5,
valueThree: 10
}
},
render: function() {
return(
<div>
<h1>Count: {this.state.count}</h1>
<Button value={this.props.valueOne} clickHandler={this.incrementCount.bind(this, this.props.valueOne)}>Add {props.valueOne}</Button>
<Button value={this.props.valueTwo} clickHandler={this.incrementCount.bind(this, this.props.valueTwo)}>Add {props.valueTwo}</Button>
<Button value={this.props.valueThree} clickHandler={this.incrementCount.bind(this, this.props.valueThree)}>Add {props.valueThree}</Button>
</div>
)
}
});
var Button = function(props){
return(
<button value={props.value} onClick={this.clickHandler}> Add {props.value}</button>
)
};
ReactDOM.render(
<CounterChallenge />,
document.getElementById('app')
);

<h1>element.onClick={this.clickHandler}toonClick={props.clickHandler}