Skip to content

Anaiah -Possom C24#32

Open
Anaiahm wants to merge 6 commits intoAda-C24:mainfrom
Anaiahm:main
Open

Anaiah -Possom C24#32
Anaiahm wants to merge 6 commits intoAda-C24:mainfrom
Anaiahm:main

Conversation

@Anaiahm
Copy link
Copy Markdown

@Anaiahm Anaiahm commented Dec 16, 2025

No description provided.

Comment thread src/App.jsx
<div id="App">
<header>
<h1>Application title</h1>
<h1>Messenger App</h1>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗️ On line 24, you should have changed the title so that the header rendered "Chat between Vladimir and Estragon"

Can you think of a way to dynamically get the senders' names without hardcoding "Vladimir" and "Estragon" here?

Comment thread src/App.jsx
);
};

const totalLikes = messages.filter(message => message.liked).length;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Nice! You could also use reduce too.

Comment thread src/App.jsx
Comment on lines +10 to +11
setMessages(prevMessages =>
prevMessages.map(message =>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job using the callback-style for updating the state.

@@ -0,0 +1,22 @@
import ChatEntry from "./ChatEntry"

const ChatLog = (props) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer props to be destructured, like I mentioned in my comment in ChatEntry.

Comment on lines +6 to +7
{props.entries.map(entry => (
<ChatEntry
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another common way you'll see components organized using map is to store the result into a variable we use in the JSX result:

  const chatEntries = entries.map((entry) => {
    return (
      <ChatEntry
        // your props
      />
    );
  });

  return <section className="chat-log">{chatEntries}</section>;

import TimeStamp from './TimeStamp';
import PropTypes from 'prop-types';

const ChatEntry = (props) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Destructuring props can be a matter of preference. I prefer to destructure props so that I don't need to type props. every time I want to get an attribute from the object.

Destructuring props also has some benefits:

  • you know every possible prop right away.
  • you know when a prop is being unused, in order to remove it.
  • knowing which props are being used will also remind you what you need to validate

Ultimately, you'll adapt what you do depending on what your team does.

<p>Replace with body of ChatEntry</p>
<p className="entry-time">Replace with TimeStamp component</p>
<button className="like">🤍</button>
<article className="chat-entry local ">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 Nitpick: white spacing is off

Suggested change
<article className="chat-entry local ">
<article className="chat-entry local">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was an optional enhancement, but how could you determine if a chat was from a 'local' sender vs a 'remote' sender so that the chat bubbles would have different styles applied to it?

If you have time to re-visit this project for React.js review, it would be good practice to try applying local vs. remote classes to the components so they render differently depending on who sent the message.

<p className="entry-time">Replace with TimeStamp component</p>
<button className="like">🤍</button>
<article className="chat-entry local ">
<section className="chat-entry local">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could remove this section element since you use the article element directly before this to wrap elements of the ChatEntry component.

The article element also has the exact same classes on it so it feels a little redundant to have article and then section.

Suggested change
<section className="chat-entry local">

<section className="entry-bubble">
<p>{props.body}</p>
<p className="entry-time">
<TimeStamp time={props.timeStamp}></TimeStamp>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work using the provided TimeStamp component here 👍

<p className="entry-time">
<TimeStamp time={props.timeStamp}></TimeStamp>
</p>
<button className="like" onClick={props.onToggleLike}>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since a ChatEntry component gets liked and it knows its own id then we can pass the function down to ChatComponent and pass the id here, like this:

Suggested change
<button className="like" onClick={props.onToggleLike}>
<button className="like" onClick={() => props.onToggleLike(id)}>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants