React-1

by bhupendra negi

JavaScript

// write code here and click the execute button


class Button extends React.Component {

constructor(props){
super(props);
this.state = { counter:10};
console.log(props);
}
handleClick = () => {
this.setState({counter:this.state.counter+1})
}
render() {
return (
<button onClick = {this.handleClick}> {this.state.counter} </button>
)}
}

ReactDOM.render(<Button />,mountNode);