Skip to content

Instantly share code, notes, and snippets.

@codeaholicguy
Created April 5, 2017 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeaholicguy/1e594eaf16aa19bf29b01e17cd6125ac to your computer and use it in GitHub Desktop.
Save codeaholicguy/1e594eaf16aa19bf29b01e17cd6125ac to your computer and use it in GitHub Desktop.
import React, {PropTypes, Component} from 'react';
export default class Track extends Component {
static propTypes = {
track: PropTypes.object.isRequired,
play: PropTypes.func.isRequired
}
_play() {
this.props.play(this.props.track);
}
render() {
const {origin: {artwork_url, title}} = this.props.track
return (
<div className='track'>
<img src={artwork_url} />
{title}
<button onClick={() => this._play()} type='button'>Play</button>
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment