-
Notifications
You must be signed in to change notification settings - Fork 153
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
Alexis Miller - Cheetahs #121
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.
Hi Alexis! Your submission has been scored as green. You can find my comments in your code. Nice work! 😊
|
||
const onLike = (id) => { | ||
setMessageData((messageData) => | ||
messageData.map((message) => { |
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.
I'd recommend trying to avoid having too many nested functions. This totally works, but it doesn't have the best readability. more readable = easier to maintain 😌
const [messageData, setMessageData] = useState(chatMessages); | ||
|
||
const onLike = (id) => { | ||
setMessageData((messageData) => |
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.
you don't have to pass messageData
as an argument here since it's globally available in App
.
}; | ||
|
||
const calcTotalLikes = (messageData) => { | ||
return messageData.reduce((total, message) => { |
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 usage of reduce()! 👏🏾
); | ||
}; | ||
|
||
ChatLog.propTypes = { |
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.
Good prop types 👍🏾
<p className="entry-time">Replace with TimeStamp component</p> | ||
<button className="like">🤍</button> | ||
<p>{body}</p> | ||
<p className="entry-time"> |
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.
I would recommend using a div here instead of a paragraph tag since it isn't a good semantic representation of the time stamp content. Or maybe not wrapping the component in another tag at all.
No description provided.