Javascript Implementation

We flesh out the complete functionality of the Empty screen, which shows all the active user attributes. For this we need to edit the Empty.js file.

We'll cover the following...

Forgive me, I’m going to paste in a lot of code at once.

Edit the Empty.js file to contain this:

Press + to interact
import React from "react";
import "./Empty.css";
const Empty = ({ user }) => {
const { name, profile_pic, status } = user;
const first_name = name.split(" ")[0];
return (
<div className="Empty">
<h1 className="Empty__name">Welcome, {first_name} </h1>
<img src={profile_pic} alt={name} className="Empty__img" />
<p className="Empty__status">
<b>Status:</b> {status}
</p>
<button className="Empty__btn">Start a conversation</button>
<p className="Empty__info">
Search for someone to start chatting with or go to Contacts
to see who
is available
</p>
</div>
);
};
export default Empty;

Oops. What’s all that code???

Take a step back, it’s not as complex as it seems.

The component takes in a user prop. This user prop is an object ...