Skip to content

Instantly share code, notes, and snippets.

@anantbahuguna
Created June 12, 2020 14:40
Show Gist options
  • Save anantbahuguna/ad7a86349179b006270d3cca97500e80 to your computer and use it in GitHub Desktop.
Save anantbahuguna/ad7a86349179b006270d3cca97500e80 to your computer and use it in GitHub Desktop.
dev.to - 1
import React,{Component } from "react";
import "./styles.css";
export default class App extends Component {
state = {
count: 0
}
handleClick = () => {
this.setState({
count: this.state.count+1
})
console.log(this.state.count)
}
render() {
return (
<div className="App">
<h1>{this.state.count}</h1>
<button onClick={this.handleClick}>+</button>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment