Skip to content

Instantly share code, notes, and snippets.

@surajyadav9
Created February 16, 2022 03:58
Show Gist options
  • Save surajyadav9/0daa317f16dea970ca882f5750094ae1 to your computer and use it in GitHub Desktop.
Save surajyadav9/0daa317f16dea970ca882f5750094ae1 to your computer and use it in GitHub Desktop.
Using Events in React Js
class App extends Component {
constructor(props) {
super(props);
this.state = {count: 0};
}
handleClick(e) {
this.setState({count: this.state.count+1});
}
render() {
return <button onClick={this.handleClick.bind(this)}>Click</button>
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment