Search⌘ K
AI Features

Javascript Implementation

Explore how to implement JavaScript components in Redux by managing user data and building dynamic, state-driven views. Learn to extract user details and prepare components for conversation displays, setting the foundation for an interactive chat application interface.

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:

Javascript (babel-node)
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 that ...