{title}
+ {/* Display the release year */}{year}
diff --git a/21-movie-db/final/src/Movies.js b/21-movie-db/final/src/Movies.js index 49cc4b777..8e37c6dee 100644 --- a/21-movie-db/final/src/Movies.js +++ b/21-movie-db/final/src/Movies.js @@ -1,26 +1,38 @@ +// Import necessary modules and components import React from 'react' -import { useGlobalContext } from './context' -import { Link } from 'react-router-dom' -const url = - 'https://upload.wikimedia.org/wikipedia/commons/f/fc/No_picture_available.png' +import { useGlobalContext } from './context' // Custom hook to access global context +import { Link } from 'react-router-dom' // Link component for navigation +// Default URL for a placeholder image when a poster is not available +const url = 'https://upload.wikimedia.org/wikipedia/commons/f/fc/No_picture_available.png' + +// Movies component to display a list of movies const Movies = () => { + // Destructure 'movies' and 'isLoading' from the global context const { movies, isLoading } = useGlobalContext() + // Display a loading indicator if data is still being fetched if (isLoading) { return
} + + // Render a section containing movie cards return ({year}