Created
December 25, 2016 16:49
-
-
Save codeaholicguy/edf5575522d2aa055dec0d18b46b2522 to your computer and use it in GitHub Desktop.
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
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