Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,22 @@
// Step 11: Inside the return statement, write a selfclosing tag called MoviesList
// Step 12: Inside the selfclosing tag, give it an attribute called movies, and pass it this.state.movies inside a set of curly bracket.
// Step 13: Outside the class, export the App class as a default.
import React, { Component } from 'react';
import { render } from 'react-dom';
import MoviesList from './MoviesList';

class App extends Component {
constructor() {
super();
this.state = {
movies: ['Godzilla (1998)', 'Jurrasic Park', 'Titanic', 'Pulp Fiction'],
};
}
render() {
return (
<MoviesList movies={this.state.movies} />
);
}
}

export default App;
13 changes: 13 additions & 0 deletions src/components/MoviesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,16 @@
// The function should return a list item, with a javascript expression movie (the same variable as map).
// The list item should have an attribute called key, that takes in i as a javascript expression.
// Outside the arrow function, export the function MoviesList as a default.
import React from 'react';

const MoviesList = (props) => {
return (
<ul>
{props.movies.map((movie, i) => {
return <li key={i}>{movie}</li>
})}
</ul>
)
}

export default MoviesList;