Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Alexis Miller - Cheetahs #121

wants to merge 2 commits into from

Conversation

LexElena22
Copy link

No description provided.

@LexElena22 LexElena22 changed the title Alexis - Cheetahs Alexis Millers - Cheetahs Dec 23, 2022
@LexElena22 LexElena22 changed the title Alexis Millers - Cheetahs Alexis Miller - Cheetahs Dec 23, 2022
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 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) => {

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) =>

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) => {

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 = {

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">

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.

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