Last active
March 8, 2023 14:36
-
-
Save ILoveBacteria/d3040527558821da2fd9bd1b4f1c6c2f to your computer and use it in GitHub Desktop.
How to handle events correctly in React
This file contains hidden or 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 React.Component { | |
constructor(props) { | |
super(props); | |
this.chooseVideo = this.chooseVideo.bind(this); | |
} | |
chooseVideo(newVideo) { | |
this.setState({ | |
// Change something | |
}); | |
} | |
render() { | |
return ( | |
<div> | |
<h1>Video Player</h1> | |
<Menu chooseVideo={this.chooseVideo} /> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment