-
Notifications
You must be signed in to change notification settings - Fork 111
React Chat Log - HW - Sea Turtles #91
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
base: main
Are you sure you want to change the base?
Conversation
tgoslee
left a comment
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 Hope! Your app looks good and meets the requirements. I saw in learn that you were getting some console errors. I left some feedback on how to fix them. Let me know if you have any questions.
| ChatLog.propTypes = { | ||
| //Fill with correct proptypes | ||
| entries: PropTypes.arrayOf(PropTypes.object).isRequired, | ||
| update: PropTypes.func.isRequired, |
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.
In Learn, I'm sure that you saw a console error for the update prop. Because your update prop was not in the original project you can handle this error by making the update prop a required prop or you can update the tests to look for update as well as entries.
| sender: PropTypes.string.isRequired, | ||
| body: PropTypes.string.isRequired, | ||
| timeStamp: PropTypes.string.isRequired, | ||
| liked: PropTypes.bool.isRequired, |
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.
Same here. The original prop types that the test is looking for are sender, body, and timeStamp. If you added your own you can either make them not required or update the test to account for the added prop types.
| //Mapping each entry of chatMessages array to a chatEntry react component | ||
| return ( | ||
| <ChatEntry | ||
| key={entry.id} /* //Look up react keyError */ |
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 could use the index from map as the key to see if it fixes the error
return entries.map((entry , i) => ...
<ChatEntry
key={i}...| setUpdateChatLog(newChatData); | ||
| }; | ||
|
|
||
| const likeCount = updateChatLog.reduce((total, entry) => { |
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 use of reduce!
No description provided.