Skip to content

Conversation

@hawktalk25
Copy link

No description provided.

Copy link

@kendallatada kendallatada left a comment

Choose a reason for hiding this comment

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

Hi Anh! Your project has been scored as green. You can find my comments in your PR. Let me know if you have any questions. Nice work! 😊

Comment on lines +11 to +15
// {
// 'sender':'Vladimir',
// 'body':'why are you arguing with me',
// 'timeStamp':'2018-05-29T22:49:06+00:00',
// }

Choose a reason for hiding this comment

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

Be sure to remove unused code, print tests, and any comments that shouldn't be published before finalizing a project. It's good practice to keep a clean main branch that's production ready. This helps with the readability and maintainability of a project. 🧹😌

Comment on lines +29 to +37
const likeCounts = () => {
let likeCount = 0;
for (let entry of chatData) {
if (entry.liked === true) {
likeCount += 1;
}
}
return likeCount;
};

Choose a reason for hiding this comment

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

Nice job calculating the number of likes from state! ✨

Comment on lines +7 to +10
const chatEntryComponents = props.entries.map((entry, index) => {
return (
<li key={index}>
<ChatEntry

Choose a reason for hiding this comment

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

Note that it's best practice not to use the index of an item as the list item key in React since the order of items in an array can change. I'd recommend using the entry ID as the key. Also, to cut down on the number of tags, you can put the key attribute directly on the <ChatEntry> component and drop the <li> tag. This means you also won't need the <ul> tag on line 24.

Comment on lines +29 to +38
ChatLog.propTypes = {
entries: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.number.isRequired,
sender: PropTypes.string.isRequired,
body: PropTypes.string.isRequired,
timeStamp: PropTypes.string.isRequired,
liked: PropTypes.bool,
})
),

Choose a reason for hiding this comment

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

Nice job with your prop types! I'd recommend making liked required and also the entries array required too.

props.onUpdate(updatedChatEntry);
};

const like = props.liked ? '❤️' : '🤍';

Choose a reason for hiding this comment

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

Good usage of the ternary operator ✨

sender: PropTypes.string.isRequired,
body: PropTypes.string.isRequired,
timeStamp: PropTypes.string.isRequired,
liked: PropTypes.bool,

Choose a reason for hiding this comment

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

I'd recommend having liked be a required prop here too

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