Reusable UI components
📖 Scenario: You are building a simple React app that shows user profiles. Each profile has a name and an age. You want to create a reusable UI component to display each user's info nicely.
🎯 Goal: Create a reusable React component called UserCard that takes name and age as props and displays them. Then use this component to show three different users in your app.
📋 What You'll Learn
Create a React functional component named
UserCard that accepts name and age props.Display the
name and age inside the UserCard component.Create a list of three users with exact names and ages.
Render the
UserCard component for each user in the list.💡 Why This Matters
🌍 Real World
Reusable UI components help you build consistent and maintainable user interfaces by reusing code for similar parts of your app.
💼 Career
Knowing how to create and use reusable components is a key skill for React developers and front-end engineers working on scalable web apps.
Progress0 / 4 steps