Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • React Tutorial
  • React Exercise
  • React Basic Concepts
  • React Components
  • React Props
  • React Hooks
  • React Router
  • React Advanced
  • React Examples
  • React Interview Questions
  • React Projects
  • Next.js Tutorial
  • React Bootstrap
  • React Material UI
  • React Ant Design
  • React Desktop
  • React Rebass
  • React Blueprint
  • JavaScript
  • Web Technology
Open In App
Next Article:
Create a meme generator by using ReactJS
Next article icon

Movie Web Application with ReactJS

Last Updated : 10 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

React Movie APP is a movie web application project that involves creating components to display a list of movies and details about each movie along with a search functionality.

Preview Image of Final Output:

Screenshot-from-2023-10-12-18-04-13

Approach for React Movie App

To create the movie web application in React we will be using an API that provides data according to the query in the search box. Use axios to fetch teh data and display using an array map in the results component. Also the details component shows the complete details of that particular movie when clicked on it.

Steps to Create Movie Web Application App:

We will be following the below steps for creating our application:

Step 1: Initialize the project named movie-app using the npm command in the terminal

npx create-react-app movie-app

Step 2: Change your directory and enter your main folder charting as

cd movie-app

Step 3: Install axios:

npm i axios 

Project Structure of Movie Web App

We will then delete all the files that are not necessary. The file structure after deleting the files is given below:

Screenshot-from-2023-10-16-10-29-20
Project structure for React Movie App


dependencies list after installing external libraries:

"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.5.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
}

Example: The example on searching a name gives the list of matching movies title and Display the details when clicked on an item in the list.

CSS
/* App.css */ * {     margin: 0;     padding: 0;     box-sizing: border-box; }  body {     font-family: "montserrat", sans-serif;     background: linear-gradient(to right, #000428, #004e92); }  header {     width: 100%;     padding-top: 2rem;     padding-bottom: 1rem; }  header h1 {     color: #ffffff;     font-size: 4rem;     font-weight: 700;     text-align: center; }  main {     width: 100%;     max-width: 90%;     margin: 0 auto; }  .container {     display: flex;     flex-direction: row;     flex-wrap: wrap;     justify-content: center; }  .item {     width: 20rem;     text-align: left; }  .results {     display: flex;     flex-wrap: wrap;     justify-content: center;     align-items: center;     /* margin: 0 -15px; */ }  .results .result {     width: 20%;     min-width: 250px;     background: #000000;     max-height: 500px;     /* padding: 15px; */     margin: 20px 25px;     display: flex;     flex-direction: column;     cursor: pointer; }  .results .not-found {     display: flex;     flex-direction: column;     justify-content: center;     align-items: center;     text-align: center;     margin: 2rem 0.5rem; }  .results .not-found h2 {     color: #ffffff; }  .results .result img {     /* display: block; */     width: 100%;     padding: 10px 2px;     margin: 0 auto;     height: 350px;     width: 230px; }  .results .result h3 {     color: #fff;     font-size: 20px;     font-weight: 600;     width: 100%;     text-align: center;     padding: 1rem;     background: #272829;     flex: 1 100%;     transition: 0.4s ease-out; }  .result:hover {     box-shadow: 0 0 8px 3px #eaf0f7;     /* background: #dfd8d8; */ }  .results .result h3:hover {     background: #fff;     color: #223343;     box-shadow: 0 0 8px 3px #4484c4; }  .detail {     margin: 3rem 5rem;     overflow-y: scroll; }  .detail .content .rating {     margin-left: 2rem;     font-size: 1.5rem;     margin-bottom: 0;     margin-top: 1rem;     padding-bottom: 0; }  .detail .content {     display: block;     width: 100%;     height: 100%;     position: fixed;     top: 0;     left: 0;     max-width: 15000px;     /* max-height: 600px; */     padding: 25px;     background: #000000;     color: #fff;     overflow-y: scroll; }  .detail .content h2 {     font-size: 3rem;     padding: 2rem;     padding-top: 0;     padding-bottom: 0.5rem;     font-weight: 600; }  .detail .content span {     font-size: 1.4rem;     margin-left: 2rem;     margin-bottom: 3rem;     font-weight: 300;     color: #ffffff; }  .detail .content .rating {     margin-bottom: 30px; }  .detail .content .about {     display: flex;     flex-wrap: wrap;     margin: 0 -15px 30px; }  .detail .content .about img {     flex: 1 1 50%;     max-width: 300px;     opacity: none;     padding: 0 15px;     margin-left: 2rem;     margin-top: 1rem; }  .detail .content .about p {     flex: 1 50%;     padding: 15px 25px;     margin-top: 3rem;     font-size: 1.5rem; }  .detail .content .close {     /* display: inline-block; */     padding: 15px 30px;     font-size: 18px;     /* margin-top: 3rem;   margin-right: 2rem;   margin-bottom: 1rem; */     font-weight: 700;     background: #223343;     color: #fff;     /* border-radius: 8px; */     border: none;     outline: none;     appearance: none;     cursor: pointer;     transition: 0.4s ease-out;      width: 100%;     display: flex;     margin: auto;     margin-top: 5rem;     justify-content: center;     align-items: center;     border-radius: 5px; }  .detail .content button:hover {     background: #4484c4; }  .detail .content .about .close:hover {     background: #223343; }  @media screen and (max-width: 1015px) {     .results {         justify-content: center;         align-items: center;     }      .detail .content .close {         width: 100%;         display: flex;         margin: auto;         justify-content: center;         align-items: center;         border-radius: 5px;     } }  @media screen and (max-width: 683px) {     .results {         justify-content: center;         align-items: center;     }      .results .result {         margin: 10px;         justify-content: center;         align-items: center;     } }  @media screen and (max-width: 643px) {     .results .result {         margin: 15px;     } }  @media screen and (max-width: 638px) {     .results .result {         margin: 8px;     } }  @media screen and (max-width: 410px) {     header h1 {         font-size: 2.9rem;     }      .results {         display: flex;         flex-direction: column;         justify-content: center;         align-items: center;     }      .detail {         overflow-y: scroll;     }      .detail .content .close {         width: 100%;         display: flex;         margin: auto;         justify-content: center;         align-items: center;         border-radius: 5px;     }      .detail .content span {         margin-left: 0.5rem;         font-style: italic;         font-weight: bold;     }      .detail .content h2 {         padding-left: 0.5rem;         font-size: 2.1rem;         margin-bottom: 0.5rem;         font-weight: 100;     }      .detail .content .rating {         margin-left: 0.5rem;         font-weight: bold;     }      .detail .content .about img {         margin-left: 0.5rem;     } } 
CSS
/* Search.css */  .search-bar {     display: flex;     justify-content: center;     align-items: center;     margin: 1rem 0; }  .search {     width: 60%;     display: block;     padding: 15px;     border: none;     outline: none;     background: none;     background-color: #fff;     border-radius: 8px;     color: dimgrey;     font-size: 20px;     font-weight: 300;     transition: 0.4s ease-out; }  .search:focus {     box-shadow: 0 0 8px 3px #4484c4; }  @media screen and (max-width: 685px) {     .search {         width: 75%;     } }  @media screen and (max-width: 410px) {     .search {         width: 85%;     } } 
JavaScript
import React, { useState } from "react"; import axios from "axios"; import Search from "./components/Search"; import Detail from "./components/Detail"; import "./App.css";  function App() {     const [state, setState] = useState({         s: "sherlock",         results: [],         selected: {},     });      const apiurl =         "https://www.omdbapi.com/?apikey=a2526df0";      const searchInput = (e) => {         let s = e.target.value;          setState((prevState) => {             return { ...prevState, s: s };         });     };      const search = (e) => {         if (e.key === "Enter") {             axios(apiurl + "&s=" + state.s).then(                 ({ data }) => {                     let results = data.Search;                      console.log(results);                      setState((prevState) => {                         return {                             ...prevState,                             results: results,                         };                     });                 }             );         }     };      const openDetail = (id) => {         axios(apiurl + "&i=" + id).then(({ data }) => {             let result = data;              setState((prevState) => {                 return { ...prevState, selected: result };             });         });     };      const closeDetail = () => {         setState((prevState) => {             return { ...prevState, selected: {} };         });     };      return (         <div className="App">             <header className="App-header">                 <h1>Movie Mania</h1>             </header>             <main>                 <Search                     searchInput={searchInput}                     search={search}                 />                  <div className="container">                     {state.results.map((e) => (                         <div                             className="item"                             onClick={() =>                                 openDetail(e.imdbID)                             }                         >                             <img                                 style={{ width: "200px" }}                                 src={e.Poster}                             />                             <h3 style={{ color: "white" }}>                                 {e.Title}                             </h3>                         </div>                     ))}                 </div>                  {typeof state.selected.Title !=                 "undefined" ? (                     <Detail                         selected={state.selected}                         closeDetail={closeDetail}                     />                 ) : (                     false                 )}             </main>         </div>     ); }  export default App; 
JavaScript
// Filename - components/Detail.js  import React from "react";  function Detail({ selected, closeDetail }) {     return (         <section className="detail">             <div className="content">                 <h2>{selected.Title}</h2>                 <span>{selected.Year}</span>                 <p className="rating">                     Rating: {selected.imdbRating}                 </p>                  <div className="about">                     <img src={selected.Poster} alt="" />                      <p>{selected.Plot}</p>                 </div>                 <button                     className="close"                     onClick={closeDetail}                 >                     Close                 </button>             </div>         </section>     ); }  export default Detail; 
JavaScript
// Filename - Search.js   import React from "react"; import "./Search.css";  function Search({ searchInput, search }) {     return (         <div className="search-bar">             <input                 type="text"                 placeholder="Search for a Movie..."                 className="search"                 onChange={searchInput}                 onKeyPress={search}             />         </div>     ); }  export default Search; 

Steps to Run the application: We can run this application by using the following command. This will start React's development server that can be used for debugging our application.

npm run start

Output: You will see the following output on your browser screen on http://localhost:3000/.


Next Article
Create a meme generator by using ReactJS
author
sparshsukralia
Improve
Article Tags :
  • Project
  • Web Technologies
  • ReactJS
  • Web Development Projects
  • ReactJS-Projects

Similar Reads

  • BMI Calculator Using React
    In this article, we will create a BMI Calculator application using the ReactJS framework. A BMI calculator determines the relationship between a person's height and weight. It provides a numerical value that categorizes the individual as underweight, normal weight, overweight, or obese. Output Previ
    3 min read
  • Create Rock Paper Scissor Game using ReactJS
    In this article, we will create Rock, Paper, Scissors game using ReactJS. This project basically implements class components and manages the state accordingly. The player uses a particular option from Rock, Paper, or Scissors and then Computer chooses an option randomly. The logic of scoring and win
    6 min read
  • Create a Form using React JS
    Creating a From in React includes the use of JSX elements to build interactive interfaces for user inputs. We will be using HTML elements to create different input fields and functional component with useState to manage states and handle inputs. Prerequisites:Functional ComponentsJavaScript ES6JSXPr
    5 min read
  • Create a Random Joke using React app through API
    In this tutorial, we'll make a website that fetches data (joke) from an external API and displays it on the screen. We'll be using React completely to base this website. Each time we reload the page and click the button, a new joke fetched and rendered on the screen by React. As we are using React f
    3 min read
  • Nutrition Meter - Calories Tracker App using React
    GeeksforGeeks Nutrition Meter application allows users to input the name of a food item or dish they have consumed, along with details on proteins, calories, fat, carbs, etc. Users can then keep track of their calorie intake and receive a warning message if their calorie limit is exceeded. The logic
    9 min read
  • Currency converter app using ReactJS
    In this article, we will be building a very simple currency converter app with the help of an API. Our app contains three sections, one for taking the user input and storing it inside a state variable, a menu where users can change the units of conversion, and finally, a display section where we dis
    4 min read
  • Lap Memory Stopwatch using React
    Stopwatch is an application which helps to track time in hours, minutes, seconds, and milliseconds. This application implements all the basic operations of a stopwatch such as start, pause and reset button. It has an additional feature using which we can keep a record of laps which is useful when we
    5 min read
  • Typing Speed Tester using React
    In this article, we will create a Typing Speed Tester that provides a random paragraph for the user to type as accurately and quickly as possible within a fixed time limit of one minute. This application also displays the time remaining, counts mistakes calculates the words per minute and characters
    9 min read
  • Number Format Converter using React
    In this article, we will create Number Format Converter, that provides various features for users like to conversion between decimal, binary, octal and hexadecimal representations. Using functional components and state management, this program enables users to input a number and perform a range of c
    7 min read
  • Create a Password Validator using ReactJS
    Password must be strong so that hackers can not hack them easily. The following example shows how to check the password strength of the user input password in ReactJS. We will use the validator module to achieve this functionality. We will call the isStrongPassword function and pass the conditions a
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences