CodeBlanks Logo Icon CodeBlanks

Project: Profile card

Review the goal and steps of the profile card project.

Project: Profile card

In this project you'll build a profile card app. The card will hold an avatar, a name and a few info items. Our goal is to design a real card by nesting components.

The steps are: first you'll write the Avatar component showing a name and role; then add an InfoList component that lists the info; finally you'll combine them in a ProfileCard component.

Each lesson adds a piece with a code step, and the starting carries the previous lesson's solution.

Practice Avatar skeleton

Complete the skeleton. Write a component called Avatar that returns <div className="avatar"> with <p>Ayşe</p> and <p>Developer</p> inside. Don't forget to export.

Starter code

App.jsx
// Write the Avatar component here

Sample solution

App.jsx
function Avatar() {
  return <div className="avatar"><p>Ayşe</p><p>Developer</p></div>;
}

export default Avatar;

Practice Add a second line to Avatar

Complete the skeleton. Write a component called Avatar that returns <div className="avatar"> with three <p> tags: name, role and city. Don't forget to export.

Starter code

App.jsx
// Write the Avatar component here

Sample solution

App.jsx
function Avatar() {
  return <div className="avatar"><p>Ayşe</p><p>Geliştirici</p><p>İstanbul</p></div>;
}

export default Avatar;

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What pieces does a profile card have?

  • Avatar, name, info list Correct answer
  • Only a name
  • Only an avatar
  • Only a button

Explanation: A profile card has avatar, name and info list.

2 Project first step

Question
In the first step you'll write the ____ component.
Answer
In the first step you'll write the Avatar component.

Explanation: Avatar is the first step.

3 Match the project steps

Term Meaning
Avatar Name and role
InfoList Info list
ProfileCard Combine
export Export

All lessons in Beginner