Assemble the card
- React course
- Beginner
- Lesson 16/84
- 5 min
Combine the avatar and info list into a ProfileCard component.
Assemble the card
In the last step you'll combine the Avatar and InfoList components inside ProfileCard. This is the final step of the project.
ProfileCard calls Avatar first, then InfoList, inside an <article className="card">. The two small components form a single card.
This structure lets you change Avatar or InfoList independently without touching ProfileCard.
Order of combination
ProfileCard calls the two components in order: Avatar first, then InfoList. This order sets the visual layout: name on top, info below.
Changing the call order changes the card's look. If info comes first, you get a different profile card.
In this project we want Avatar on top, so we call it first.
Practice ProfileCard combination
Complete the skeleton. Write a component called ProfileCard that calls <Avatar /> and <InfoList /> inside <article className="card">. Don't forget to export.
Starter code
// Write the ProfileCard component here
// Avatar and InfoList are already definedSample solution
function ProfileCard() {
return <article className="card"><Avatar /><InfoList /></article>;
}
export default ProfileCard;Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What does ProfileCard call?
- Only p
- Only Header
- Only Footer
- Avatar and InfoList Correct answer
Explanation: ProfileCard calls Avatar and InfoList.
2 Card wrapper
ProfileCard is held inside an ____.
ProfileCard is held inside an article.
Explanation: article suits standalone content.
3 The whole project
| Term | Meaning |
|---|---|
Avatar |
Name and role |
InfoList |
Info list |
ProfileCard |
Combination |
article |
Wrapper |