import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' import Header from '../../components/Header' import List from '../../components/List' import * as mopidyActions from '../../services/mopidy/actions' import * as spotifyActions from '../../services/spotify/actions' class LibraryLocalArtists extends React.Component{ constructor(props) { super(props); } // on render componentDidMount(){ this.loadArtists() } componentWillReceiveProps( nextProps ){ if( !this.props.mopidy.connected && nextProps.mopidy.connected ){ this.loadArtists(nextProps); } } loadArtists(props = this.props){ if( props.mopidy.connected ){ this.props.mopidyActions.getArtists(); } } render(){ if( !this.props.mopidy.artists ) return null return (