Mahamudul Hasan Rubel
HomeAboutProjectsSkillsExperienceBlogCoursesPhotosContact
Mahamudul Hasan Rubel

Senior Software Engineer crafting high-performance web applications and SaaS platforms.

Navigation

  • Home
  • About
  • Projects
  • Skills
  • Experience
  • Blog
  • Courses
  • Photos
  • Contact

Get in Touch

Available for senior/lead roles and consulting.

bd.mhrubel@gmail.comHire Me

© 2026 Mahamudul Hasan Rubel. All rights reserved.

Built with using Next.js 16 & Tailwind v4

Back to Blog
Lesson 8 of the React Fundamentals: Build Modern UIs from Scratch course
ReactJune 25, 20263 min read

Dynamic Movie Cards: Building Reusable React Components

Learn to build a reusable MovieCard component to display dynamic data. Master props and component architecture for a scalable React movie browser app.

ReactComponentsPropsFrontendWeb Developmentjavascript

Previously in this course, we covered Passing Data with Props: A Guide to React Component Communication. Now that you understand the basic mechanics of sending information from a parent to a child, it’s time to apply that knowledge to our project.

In this lesson, we are moving beyond static placeholders. We will build a single, highly reusable component—the MovieCard—and learn how to inject unique data into multiple instances of that card to create a professional movie browser interface.

Thinking in Components: The Reusable MovieCard

When building UI, repeating code is the enemy of maintainability. If you need to update the layout of your movie cards later, you don't want to hunt down five different div blocks in your App.jsx.

A reusable component acts as a template. By using props, we define the structure once and pass the content dynamically. This is the cornerstone of declarative UI development.

From Static to Dynamic: A Worked Example

In our current project, we likely have a hardcoded list of movies. Let’s refactor that into a clean, reusable MovieCard component.

First, create a new file named MovieCard.jsx. We will design it to accept title and description as props:

JSX
// MovieCard.jsx
export default function MovieCard({ title, description }) {
  return (
    <div className="movie-card">
      <h3>{title}</h3>
      <p>{description}</p>
    </div>
  );
}

Now, back in your App.jsx, import this component and use it multiple times. Notice how we pass unique data to each instance:

JSX
// App.jsx
import MovieCard from CE9178">'./MovieCard';

function App() {
  return (
    <div className="app-container">
      <h1>Movie Browser</h1>
      <MovieCard 
        title="Inception" 
        description="A thief who steals corporate secrets through dream-sharing technology." 
      />
      <MovieCard 
        title="Interstellar" 
        description="A team of explorers travel through a wormhole in space." 
      />
    </div>
  );
}

By passing different strings to the title and description attributes, we’ve created a dynamic interface without duplicating the underlying HTML structure.

Prop Drilling: The First Steps

You might notice that as your app grows, you often pass data from a parent (like App.jsx) to a child (MovieCard). This is the foundation of prop drilling.

Prop drilling refers to the process of passing data down through the component tree. While it can become cumbersome in massive applications, it is the fundamental way React components share information. For now, focus on keeping your data flow clean: the parent manages the data, and the child (the MovieCard) simply renders it.

Hands-on Exercise

Your goal is to expand the MovieCard to include a year prop.

  1. Update MovieCard.jsx to accept a third prop named year.
  2. Add a new <span> or <small> tag inside the component to display the year.
  3. Update your instances in App.jsx to include a year attribute (e.g., year="2010").
  4. Verify that each card now displays its unique release year alongside the title and description.

Common Pitfalls

  • Missing Props: If you forget to pass a prop, the component will receive undefined. Always provide default values or ensure your data source is robust.
  • Over-complicating Components: If your MovieCard starts doing too much—like fetching its own data or managing complex state—it’s time to break it down further, perhaps into a MovieTitle or MovieDescription sub-component.
  • Forgetting the Import: A classic "beginner" error is defining a component but forgetting the import statement in the parent file. Always check your console for "Component is not defined" errors.

Recap

We've successfully moved from static code to dynamic UI. By extracting our movie display logic into a reusable component, we've made our code easier to read and maintain. We've also practiced the fundamentals of passing props to customize these instances. This component-based approach is how we build everything from simple websites to complex applications, as we discussed in our Introduction to Component-Based Architecture in React.

Up next: We will explore Component Composition, where we learn how to nest components within each other to build even more complex and flexible UI structures.

Previous lessonPassing Data with PropsNext lesson Component Composition
Back to Blog

Similar Posts

ReactReactJune 25, 20263 min read

Building a Movie Filter Toggle in React: A Beginner's Guide

Master the art of UI state management by adding a filter toggle to your movie app. Learn to control list rendering using boolean state and checkbox inputs.

Read more
ReactReactJune 24, 2026

Part of the course

React Fundamentals: Build Modern UIs from Scratch

beginner · Lesson 8 of 49

  1. 1

    Introduction to Component-Based Architecture

    4 min
  2. 2

    Understanding the Virtual DOM

    4 min
  3. 3

    Setting Up with Vite

    3 min
3 min read

Setting Up with Vite: A Professional React Development Environment

Learn how to initialize a professional React project using Vite. We’ll cover the project directory structure and how to launch your fast development environment.

Read more
ReactReactJune 25, 20263 min read

Fetching Data from an API: A Practical React Guide

Master the fetch API in React to retrieve external data. Learn to perform asynchronous requests and store JSON responses in your component state effectively.

Read more
4

Mastering JSX Syntax

4 min
  • 5

    Creating Static Components

    3 min
  • 6

    Styling Components

    3 min
  • 7

    Passing Data with Props

    3 min
  • 8

    Dynamic Movie Cards

    3 min
  • 9

    Component Composition

    3 min
  • 10

    Conditional Rendering

    3 min
  • 11

    Rendering Lists of Data

    4 min
  • 12

    The Key Prop Explained

    4 min
  • 13

    Introduction to React State

    4 min
  • 14

    Managing State with useState

    3 min
  • 15

    Building an Interactive Search Bar

    3 min
  • 16

    Handling Click Events

    4 min
  • 17

    Updating State Based on Previous State

    4 min
  • 18

    Filtering the Movie List

    3 min
  • 19

    Handling Form Submissions

    3 min
  • 20

    Controlled Components

    4 min
  • 21

    Event Bubbling and Propagation

    3 min
  • 22

    Building a Movie Filter Toggle

    3 min
  • 23

    Introduction to Side Effects

    4 min
  • 24

    useEffect Dependencies

    4 min
  • 25

    Fetching Data from an API

    3 min
  • 26

    Handling Loading States

    3 min
  • 27

    Managing Errors

    3 min
  • 28

    Cleanup Functions in useEffect

    3 min
  • 29

    Debouncing Search Input

    3 min
  • 30

    Refactoring for Clean Code

    3 min
  • 31

    Folder Structure Best Practices

    4 min
  • 32

    Extracting Custom Hooks

    3 min
  • 33

    Prop Drilling and Context API

    3 min
  • 34

    Polishing the UI

    Coming soon
  • 35

    Finalizing the Movie Browser

    Coming soon
  • 36

    Review of Component Lifecycle

    Coming soon
  • 37

    Review of State Management

    Coming soon
  • 38

    Building a Modal Component

    Coming soon
  • 39

    Introduction to PropTypes

    Coming soon
  • 40

    Performance Optimization Basics

    Coming soon
  • 41

    Handling Browser History

    Coming soon
  • 42

    Working with LocalStorage

    Coming soon
  • 43

    Building a Favorites List

    Coming soon
  • 44

    Handling Media in React

    Coming soon
  • 45

    Introduction to Testing

    Coming soon
  • 46

    Debugging React Apps

    Coming soon
  • 47

    Deployment Basics

    Coming soon
  • 48

    Using External Libraries

    Coming soon
  • 49

    Advanced

    Coming soon
  • View full course