import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' import Header from '../../components/Header' import * as spotifyActions from '../../services/spotify/actions' class Discover extends React.Component{ constructor(props) { super(props); } // on render componentDidMount(){ this.props.spotifyActions.getPlaylist( this.props.params.uri ); } // when props changed componentWillReceiveProps( nextProps ){ if( nextProps.params.uri != this.props.params.uri ){ this.props.spotifyActions.getPlaylist( nextProps.params.uri ); } } render(){ if( this.props.spotify.playlist ){ return (