-
Notifications
You must be signed in to change notification settings - Fork 111
Otters - Jodi Denney #93
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
goeunpark
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.
Wonderful work, Jodi! 🎉
Your tests pass, your props cascade down beautifully, and your App-level state is managed delightfully! This code is so clean and well-thought out; it is a well-deserved Green. 🟢
Keep it up! 🚀
| import './App.css'; | ||
| import chatMessages from './data/messages.json'; | ||
| import ChatLog from './components/ChatLog'; | ||
| import { useState } from 'react'; |
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.
We can combine L1 and L4 into one line because they're both imported from the react library:
import React, { useState } from 'react';
| const [entries, setEntries] = useState(chatMessages); | ||
| const [likes, setLikes] = useState(0); |
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.
So organized, setting all the state variables at the top of the component! Love to see it 💖
| setEntries(newEntries); | ||
| setLikes(currentLikes); |
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.
Oooo, so efficient. ✨
| }; | ||
|
|
||
| ChatLog.propTypes = { | ||
| entries: PropTypes.array.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.
We should also add toggleHeartCallback as a required prop type.
| ); | ||
| }); | ||
|
|
||
| return <ul>{chatComponents}</ul>; |
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.
Love that you used semantic HTML with <ul> and <li> here!
| const ChatEntry = (props) => { | ||
| const toggleHeart = () => { | ||
| props.toggleHeartCallback(props.id); | ||
| }; |
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.
Small nit, a space after this life would help with readability!
Otters - Jodi Denney