Skip to content

Instantly share code, notes, and snippets.

@otang
Created January 10, 2016 01:44
Show Gist options
  • Save otang/2ab4a88d6bf4e2df1af9 to your computer and use it in GitHub Desktop.
Save otang/2ab4a88d6bf4e2df1af9 to your computer and use it in GitHub Desktop.
ChildComponent = React.createClass({
render: function() {
return (
<button onClick={this.props.onClick} />
);
}
});
Playlist = React.createClass({
handleClickSong: function(song) {
console.log('A song in a child component was clicked');
this.setState({selectedSong: song});
},
render: function() {
return (
<ChildComponent onClick={this.handleClickSong} />
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment