-
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
Tigers-Samiya-Chatlog #126
base: main
Are you sure you want to change the base?
Conversation
…t two tests although the app is working.
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.
YELLOW! Overall this is a really good start, Samiya! The one glaring issue that keeps this from being a green is that you don't ever modify the messages list. You can toggle the heart front end, and you have found a workaround to make it count the number of likes. However, the actual information itself is never changed on the message's end.
setLikeCount(likesCount-1) | ||
|
||
} | ||
} |
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.
This is a good start. However, your program is only changing the state of the likesCount and doesn't ever address the chatMessages. When you change the buttons, the likes will change visually, but each message's backend data will remain unchanged.
</header> | ||
<main> | ||
{/* Wave 01: Render one ChatEntry component | ||
<ChatLog entries={chatMessages}updateLikes={updateLikes} |
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.
Well done passing parameters via props!
setLikeButton('🤍') | ||
props.updateLikes(false) | ||
} | ||
} |
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.
Here is where you could have used the state that you pass in to handle what your output is. For example, if we had a props parameter called "isLiked," we could have used that in a simple ternary operator to spit out either the liked heart or the unliked heart.
body:PropTypes.string.isRequired, | ||
timeStamp:PropTypes.string.isRequired, | ||
likes: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.
Great use of proptypes here!
<p className="entry-time"> | ||
<TimeStamp time={props.timeStamp}/> | ||
</p> | ||
<button className="like" onClick={clickedToggle}>{likeButton}</button> |
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.
emember that we have passed down a function that is supposed to handle this for us. If we are having to rewrite this function, we aren't effectively lifting state up.
|
||
); | ||
}; | ||
|
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.
Missing our proptypes! Other than that, this component is well-written!
My vs code was not working with the tests so i had to alter them to be single quotes. I didn't really know what to do so changed the test bc VS code was not happy!