Challenge: Product Listing Page
Test your React components skills by implementing the product listing page.
Problem statement
You are tasked with creating a product listing page as part of a larger online store application. This page should include a header, display a list of products, indicate if a product is on sale, and feature a “Buy now” button that responds to user clicks. All components should be stateless, and all dynamic behavior or content should be driven by props.
Task 1: Building the UI structure and applying styles
Create a
Header
component that displays a title, e.g., “Our Products”.Create a
ProductItem
component that acceptsname
,price
, andcategory
as props. It renders the product’s name and price. The overall layout should be styled (e.g., a simple card-style design). Ifcategory
issale
, you will later add aTag
component to indicate it’s on sale. For now, just ensureProductItem
is ready to show that tag.Integrate components in the
App
component. Render theHeader
at the top, and then render multipleProductItem
components, each with different props. Finally, style the container inApp
(e.g., centered layout, some margin).
Expected output
A page with a titled header “Our Products” and a list of products each displayed neatly.
Get hands-on with 1400+ tech skills courses.