I am building a simple single page app on react.js for the first time using spotifys api keys. Ive managed to get the song info on the page when a user is playing a song. How can I add an else statement to this so that I have something like "No Playback deteced" appear when nothing is playing?
{ (() => {
if (this.state.nowPlaying.id) {
return (
<div>
<div> Now Playing: { this.state.nowPlaying.name} </div>
<div> By: { this.state.nowPlaying.artist} </div>
<div> Id: { this.state.nowPlaying.id} </div>
<div> Progress: { this.state.nowPlaying.progress} </div>
<div>
<img src={ this.state.nowPlaying.image} style=/>
</div>
<AudioFeatures
id={this.state.nowPlaying.id}
ref={this.audioFeatures}
oAuth={this.state.oAuth}
/>
</div>
);
}
}
})()
}
Thanks.
Aucun commentaire:
Enregistrer un commentaire