Open
Conversation
spitsfire
reviewed
Jun 28, 2022
Comment on lines
+12
to
+15
| const entries = messageData.map((message) => { | ||
| if (message.id === messageToUpdate.id) { | ||
| return messageToUpdate | ||
| } |
There was a problem hiding this comment.
hmm I'm a little confused by this if statement and variable. I don't see you using entries anywhere. Do you need this? It doesn't look like you are updating messageData, only checking to see if messagesToUpdate "exists" in order to add likes.
I think all you need is lines 16-22
| } | ||
|
|
||
| const updateLiked = () => { | ||
| console.log('updating heart') |
There was a problem hiding this comment.
Suggested change
| console.log('updating heart') |
Comment on lines
+19
to
+22
| sender: sender, | ||
| body: body, | ||
| timeStamp: timeStamp, | ||
| id: id, |
There was a problem hiding this comment.
hmm you are giving this function a lot of editing power when it only needs to update the isLiked property. Think about giving the function access only to isLiked.
| import ChatEntry from './ChatEntry'; | ||
| import './ChatLog.css'; | ||
|
|
||
| const ChatLog = ({ entries, id, liked, onUpdateMessage }) => { |
Comment on lines
+9
to
+13
| if (isLiked) { | ||
| console.log('is liked'); | ||
| } else { | ||
| console.log('is unliked'); | ||
| } |
There was a problem hiding this comment.
Don't forget to get rid of debugging comments once you're ready to submit the final submission
Suggested change
| if (isLiked) { | |
| console.log('is liked'); | |
| } else { | |
| console.log('is unliked'); | |
| } |
| import chatMessages from './data/messages.json'; | ||
|
|
||
| import ChatLog from './components/ChatLog' | ||
| const App = () => { |
| import PropTypes from 'prop-types'; | ||
| import TimeStamp from './TimeStamp'; | ||
|
|
||
| const ChatEntry = ({ sender, body, liked, timeStamp, id, onUpdateMessage }) => { |
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.