Thinking in components
5 minEvery screen you design is a tree of small pieces, each with one job. You'll split Airbnb's search results into that tree, and see how one card becomes all 18 results.
Lesson video
Tastebud · 5:16 · Captions on screen
Split a screen into components you can each describe in one sentence without the word and.
- Why. A component with one job has one reason to change. Fix how prices show in Price, and every card that uses it gets the fix at once.
- Real example. Search Goa on Airbnb and the first page shows 18 homes. Each is the same card with its own photos, price and rating, and some add a Guest favourite badge. (Airbnb, Nov 2026)
- When to break it. A one-off piece, like a single launch announcement, can stay plain markup. Splitting something that never repeats or changes adds files and saves no work.
- Common mistake. One giant component per screen. The wishlist page needs the same card, so someone copies it out, and the two copies drift apart with every fix.
Our take. Name each component for its job, like Price, never for its place, like LeftColumn. Redesigns move things around, and a name that describes the job still fits afterwards.
Draw a box around every piece with a job
Start on the design, before any code. Draw a box around each piece that has its own job, and name it. A box drawn inside another box becomes its child in the tree. The picture boxes one card into its parts.
Recreated from Airbnb's Goa search results on the web, Nov 2026.
Test each box: one job, said without and
Each component's job fits in one sentence. If the sentence needs the word and to join two jobs, you have two components. A card that shows a home and also loads more results can't go anywhere results don't load.
Only ListingCard's sentence joins two jobs, so only it splits
- WishlistButton: one job. It fills the heart when you save this home and empties it when you unsave. Those are two states of one toggle.
- Price: one job. It shows the stay's cost, with any old price struck through. The struck price is part of that job.
- ListingCard: two jobs, so split. As written, it showed one home and loaded more results when you scrolled.
- ListingCard shows one home. Now it can sit on the wishlist page without fetching search results there.
- ListingGrid loads more results. Loading more is the grid's job, so it moves there.
In React, each box becomes a function
A React component is a function that returns markup, and its name starts with a capital letter. ListingCard then reads like the tree: a list of its parts, each given only the data it needs.
- Fetches the next page of homes
- Tracks which hearts are filled
- Formats ₹9,495 and the struck price
- Copied to make the wishlist page
- <PhotoCarousel photos={home.photos} />
- <WishlistButton homeId={home.id} />
- <Price now={home.price} was={home.oldPrice} nights={home.nights} />
- <Rating score={home.rating} reviews={home.reviews} />
The right-hand card can go on any page that has a home to show, including the wishlist.
Try it
Sort the pieces into the tree
These pieces come from Airbnb's Goa search results, Nov 2026. Put each one in the component that should own it.
Homes in Goa
Add guests
Over 1,000 homes
Prices include all fees
Guest favourite
₹9,495 for 2 nights
4.91 (130)
Show map
Quick check
Your ListingCard also loads the next page of results. The wishlist page needs the same card. What do you do?
Watch next
Watch it for A component as a function that returns markup, and how small components nest inside bigger ones.
Watch it for How a page splits into header, sidebar, content and footer components, and how one component is reused.
Connects to: 2.2 Semantic HTML · 4.1 JavaScript and the DOM · 9.2 Your first components · 12.1 Reading a Figma file
Sources · checked Nov 2026
- Airbnb: Goa search results on the web (airbnb.co.in)18 results on the first page, Over 1,000 homes, Prices include all fees, the search bar wording, and the first card: Guest favourite, Flat in Candolim, 1–3 Dec, ₹9,495 for 2 nights (originally ₹12,051), 4.91 (130), Show map
- React: Thinking in ReactDraw boxes around every component in the mockup and name them; a box inside another becomes its child; a component should ideally be concerned with one thing
- React: Your First ComponentReact components are JavaScript functions that return markup, and their names must start with a capital letter
- React: Rendering Listsmap() over an array, and each item needs a stable key so React can match items when the list changes
- React: VersionsReact 19.3.1 (14 Oct 2026), from the course fact sheet