react conditional rendering stack overflow code example
Example: conditional rendering in react js stackoverflow
//conditional rendering in react JS
<Container>
{this.state.watchlist.length === 0 && <h1>no movies</h1>}
{this.state.watchlist.map(item => (<WatchlistMovie
className="watchlist-movie"
key={item.id}
id={item.id}
title={item.title}
poster={item.poster}
overview={item.overview}
rating={item.rating}
user={this.props.user}
/>))}
</Container>