// data
const movies = [
{
'Title': 'The Avengers',
'Plot': 'Earth\'s mightiest heroes must come together and learn to fight as a team if they are to stop the mischievous Loki and his alien army from enslaving humanity.',
'Poster': 'http://ia.media-imdb.com/images/M/MV5BMTk2NTI1MTU4N15BMl5BanBnXkFtZTcwODg0OTY0Nw@@._V1_SX300.jpg'
},
{
'Title':'The Dark Knight',
'Plot': 'When the menace known as the Joker wreaks havoc and chaos on the people of Gotham, the caped crusader must come to terms with one of the greatest psychological tests of his ability to fight injustice.',
'Poster':'https://images-na.ssl-images-amazon.com/images/M/MV5BMTMxNTMwODM0NF5BMl5BanBnXkFtZTcwODAyMTk2Mw@@._V1_SX300.jpg'
}
];
// components
class MovieBox extends React.Component {
render() {
return (
<div className='movie__box'>
<img src={this.props.data.Poster }/>
<h3>{ this.props.data.Title }</h3>
<p className='movie__plot'>
<span>Plot:</span> { this.props.data.Plot }
</p>
</div>
);
}
}
const noMovies = [];
class Movies extends React.Component {
renderMovie(movie) {
return <MovieBox data={ movie }/>;
}
render() {
const movies = this.props.movies;
return (
<div className="movies">
{ (movies || noMovies).map(this.renderMovie) }
</div>
);
}
}
ReactDOM.render(<Movies movies={ movies }/>, document.querySelector('#movies'));
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.