Skip to content

Conversation

GalinaR
Copy link

@GalinaR GalinaR commented Dec 22, 2022

No description provided.

Copy link

@yangashley yangashley left a comment

Choose a reason for hiding this comment

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

Nice job on your first solo react project! Let me know if you have questions about the comments

Comment on lines +23 to +24
return chatData.reduce((total, current) => {
return total + current.liked;

Choose a reason for hiding this comment

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

Way to use reduce here!

It's cool that you leveraged the knowledge that in JavaScript if you add a boolean to something it gets cast as a number (0 for false, 1 for true). Prefer you use conditional logic to add a number to a number instead.

<button className="like">🤍</button>
<p>{props.body}</p>
<p className="entry-time">
<TimeStamp time={props.timeStamp} />

Choose a reason for hiding this comment

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

Nice job using the provided TimeStamp component

import TimeStamp from './TimeStamp';

const ChatEntry = (props) => {
const heartIcon = props.liked ? '❤️' : '🤍';

Choose a reason for hiding this comment

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

👍

Comment on lines +8 to +19
<ul>
{props.entries.map((entry) => (
<ChatEntry
id={entry.id}
sender={entry.sender}
body={entry.body}
timeStamp={entry.timeStamp}
liked={entry.liked}
onToggleLiked={props.onToggleLiked}
/>
))}
</ul>

Choose a reason for hiding this comment

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

Looks good! I like that you directly use map within the

    element

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