-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React-Chatlog-Marlyn-C17 #97
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
I left one really small comment but everything else looks good!
Well done!
const newChatEntries = chatEntries.map((chatEntry) => { | ||
const newChatEntry = { ...chatEntry }; | ||
if (newChatEntry.id === id) { | ||
newChatEntry.liked = !newChatEntry.liked; | ||
} | ||
if (newChatEntry.liked === true) { | ||
likesCount += 1; | ||
} | ||
return newChatEntry; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job making a deep copy using map
.
const ChatEntry = ({ | ||
id, | ||
sender, | ||
body, | ||
timeStamp, | ||
liked, | ||
likesCountCallBack, | ||
}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of destructuring in the argument list! 🙂
<div> | ||
<ul> {chatComponents} </ul> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style: I can't remember if the styles need it, but you don't need a surrounding div
since you already have a surrounding ul
.
No description provided.