Open
Conversation
yangashley
reviewed
Jan 5, 2023
yangashley
left a comment
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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} /> |
There was a problem hiding this comment.
Nice job using the provided TimeStamp component
| import TimeStamp from './TimeStamp'; | ||
|
|
||
| const ChatEntry = (props) => { | ||
| const heartIcon = props.liked ? '❤️' : '🤍'; |
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> |
There was a problem hiding this comment.
Looks good! I like that you directly use map within the
- element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.