A React-based movie discovery application that fetches and displays popular movies using The Movie Database (TMDB) API. Users can browse a responsive grid of movie posters and click to view detailed information about each film.
Tech Stack:
- React with Hooks (
useState,useEffect,useParams) - React Router for multi-page navigation
- Styled Components
- TMDB API for movie data
- Vite as the build tool
Key Features:
- Browse popular movies in popular movies page
- View detailed movie information (title, rating, overview, backdrop) in the movie details page
Challenges Overcome:
- Extracting and using API data structure effectively
- Responsive image handling and Lighthouse optimization
- Using
$prefix in styled-components to avoid React DOM warnings - Nested component hover effects without class names in styled-components
- Used environment variables (
import.meta.env.VITE_TMDB_API_KEY) for secure API key storage - Fixed an issue with Netlify’s secret scanning when deploying a Vite app by telling it to ignore a public API key, since Vite makes VITE_* variables available in the browser.
Implemented features:
- Created main Movies page displaying popular movies from TMDB API
- Implemented state management with
useStatehooks:movies- stores fetched movie dataloading- handles loading stateerror- manages error states
- Added API integration using
fetchto retrieve popular movies from TMDB - Implemented error handling with HTTP status validation
- Created conditional rendering:
- Shows
Loadercomponent during data fetching - Displays error message if API call fails
- Renders movie grid when data is successfully loaded
- Shows
- Styled with
styled-componentsin MovieCard.jsx - Mapped through movie results and rendered
MovieCardcomponent for each movie - Used React Router's
Linkcomponent
Implemented features:
- Created custom 404 error page
- Built with
styled-componentsfor styling:NotFoundWrapper- full-screen centered container with gradient backgroundErrorCode- large animated "404" text with gradient effectTitle- styled heading with text shadowMessage- user-friendly error message with emojiBackButton- styled Link component with hover effects
- Added navigation back to home page using React Router's
Linkcomponent
Implemented features:
- Created dynamic movie details page using
UseParams - Implemented state management with
useStatehooks:movie- stored fetched movie details dataloading- handles loading stateerror- manages 404 error page
- Fetched movie details from TMDB API using
fetch - Implemented
useEffectto trigger data fetch when movie ID changes - Implemented conditional rendering:
- Displays loader component while fetching data
- Renders NotFound page on error
- Shows MovieDetailContent when data i successfully loaded
- Separated concerns by delegating UI rendering to MovieDetailContent
- Phase 1 - Basic list + detail pages with routing
- Phase 2 - Responsive design & performance optimization
- Phase 3 - Styled Components refactor
- Jennifer Jansson
- Sandra Hagevall