Skip to content

Instantly share code, notes, and snippets.

@codeaholicguy
Created December 25, 2016 16:49
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/edf5575522d2aa055dec0d18b46b2522 to your computer and use it in GitHub Desktop.
Save codeaholicguy/edf5575522d2aa055dec0d18b46b2522 to your computer and use it in GitHub Desktop.
import React, {Component, PropTypes} from 'react';
export default class TrackList extends Component {
static propTypes = {
tracks: PropTypes.array,
user: PropTypes.object,
auth: PropTypes.func
}
static defaultProps = {
tracks: []
}
render() {
return (
<div>
<div>
{
this.props.user
? <div>Hello {this.props.user.username}</div>
: <button onClick={this.props.auth} type='button'>Login</button>
}
</div>
<div>
{
this.props.tracks.map((track, key) => {
return <div key={key}>Track: {track.title}</div>;
})
}
</div>
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment