Project: Profile Card Creator
by Andrew Nguyen· Module 02 - Components and Props

Introduction
Not Attempted
NameProgress
Course outline
Not Read
Module 01 - Diving Into React
Not Attempted
NameProgress
Key Concepts
Not Read
Project: Pet Parade
Not Read
Challenge 1
Not Attempted
Quiz 1
Not Attempted
Project: Profile Card Creator
Key Concepts
Challenge 2
Not Attempted
Quiz 2
Not Attempted
Module 03 - State and Effect
Not Attempted
NameProgress
Key Concepts
Not Read
Project: Magic Garden
Not Read
Challenge 3
Not Attempted
Quiz 3
Not Attempted
Module 04 - Conditional Rendering
Not Attempted
NameProgress
Key Concepts
Not Read
Project: Weather Wardrobe
Not Read
Challenge 4
Not Attempted
Quiz 4
Not Attempted
Module 05: Handling Events
Not Attempted
NameProgress
Key Concepts
Not Read
Project: "Interactive Quiz App"
Not Read
Challenge 5
Not Attempted
Quiz 5
Not Attempted
Module 06 - Lists and Keys
Not Attempted
NameProgress
Key Concepts
Not Read
Project: "Photo Gallery"
Not Read
Challenge 6
Not Attempted
Quiz 6
Not Attempted
Module 07 - Forms and Validation
Not Attempted
NameProgress
Key Concepts
Not Read
Project: "Registration Form"
Not Read
Challenge 7
Not Read
Quiz 7
Not Attempted
Module 08 - Lifting State Up & Composition vs Inheritance
Not Attempted
NameProgress
Key Concepts
Not Read
Project: "Weather Dashboard"
Not Read
Challenge 8
Not Attempted
Quiz 8
Not Attempted
0 / 420 XP

Overview

In this project, you will create a "Profile Card Creator" — a component that displays a user profile card with a name, an image, and a bio. This will help you practice using functional components, handling props, and understanding component composition. By the end of this project, you should have a functional and visually appealing profile card that can be easily customized with different user data.

Goals

  • Learn to build functional components that receive and handle props.

  • Gain experience in composing components to create a unified user interface.

  • Enhance your ability to manage basic layout and styling in a React application.

Instructions

Step 1: Create the Components 

You'll need to create at least two components: one for the overall profile card and one or more for parts like the image and the bio.

  • ProfileCard Component: This is the main component that assembles other sub-components like <strong>ProfileImage</strong> and <strong>ProfileBio</strong>.
import React from 'react';
import ProfileImage from './ProfileImage';
import ProfileBio from './ProfileBio';

function ProfileCard({ name, image, bio }) {
  return (
    &lt;div className="profile-card"&gt;
      &lt;ProfileImage image={image} /&gt;
      &lt;h1&gt;{name}&lt;/h1&gt;
      &lt;ProfileBio bio={bio} /&gt;
    &lt;/div&gt;
  );
}

export default ProfileCard;
  • ProfileImage Component: A simple component that displays the user's image.
import React from 'react';

function ProfileImage({ image }) {
  return &lt;img src={image} alt="profile" style={{ width: '100px', height: '100px', borderRadius: '50%' }} /&gt;;
}

export default ProfileImage;
  • ProfileBio Component: A component that displays the user's bio.
import React from 'react';

function ProfileBio({ bio }) {
  return &lt;p&gt;{bio}&lt;/p&gt;;
}

export default ProfileBio;

Step 2: Integrating Components in App.js 

Now integrate your <strong>ProfileCard</strong> component into the <strong>App.js</strong> to render it with some example data.

import React from 'react';
import './App.css';
import ProfileCard from './ProfileCard';

function App() {
  return (
    &lt;div className="App"&gt;
      &lt;ProfileCard
        name="Jane Doe"
        image="&lt;https://example.com/janedoe.jpg&gt;"
        bio="Web Developer and Cat enthusiast."
      /&gt;
    &lt;/div&gt;
  );
}

export default App;

Step 3: Styling 

Add some CSS to style the profile card. This could include adding margins, aligning text, setting fonts, and more.

.profile-card {
  width: 300px;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

This project not only reinforces your understanding of React components and props but also gives you a practical output that could be used in real-world applications. Enjoy building and customizing your profile card!

Maggie

Discuss with Maggie
Use the power of generative AI to interact with course content

Discussion

0 comments
Loading editor ...
Remember to be polite and report any undesirable behaviour

Category

Empty

Labels

Discussion has no labels

1 participant

user avatar

Priority

Notifications

You're not receiving notifications from this thread.
Course Outline