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.
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.
- Update
MovieCard.jsxto accept a third prop namedyear. - Add a new
<span>or<small>tag inside the component to display the year. - Update your instances in
App.jsxto include ayearattribute (e.g.,year="2010"). - 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
MovieCardstarts doing too much—like fetching its own data or managing complex state—it’s time to break it down further, perhaps into aMovieTitleorMovieDescriptionsub-component. - Forgetting the Import: A classic "beginner" error is defining a component but forgetting the
importstatement 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.
Work with me

Next.js Full-Stack Web App Development
A fast, SEO-ready full-stack web app built with Next.js 16 — from idea to deployed product, by an engineer who ships to production.

Headless WordPress + Next.js Frontend Development
Keep WordPress for content, get a lightning-fast Next.js frontend. The best of both worlds — familiar editing, modern speed.