class App extends React.Component {
constructor() {
super();
this.state = {
prop: 1,
}
}
stateChange = () => {
this.setState({
prop: this.state.prop + 1,
});
}
render = () => {
return <div>
<p>{this.state.prop}</p>
<input type="button" value="Обновить" onClick={() => {this.stateChange()}}/>
</div>;
}
}
ReactDOM.render(<App/>, document.getElementById('body'));