Created
February 16, 2022 03:58
-
-
Save surajyadav9/0daa317f16dea970ca882f5750094ae1 to your computer and use it in GitHub Desktop.
Using Events in React Js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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