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

Week 7 - Happy Thought - Mai #82

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

Conversation

maikanetaka
Copy link

Copy link

@almaherris almaherris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Mai! Great job this week, especially after being sick for several days ⭐️

I found your code clean and easy to follow. I like that you have split up the app in a lot of components, makes it even easier to understand which part is responsible for what.

I would just review the responsiveness, since right now it looks very stretched on desktop viewport 🖥

const incrementLikedPostsCount = () => {
setLikedPostsCount((prevCount) => {
const newCount = prevCount + 1;
localStorage.setItem("likedPostsCount", newCount.toString());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and clean App.jsx! I liked that you used localStorage to store number of likes!


let wordCountMessage;
if (remainingLength >= 0) {
wordCountMessage = `You have typed ${typedLength} letters, you still can type ${remainingLength} letters.`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this friendly way of helping the user to keep track of the character count, not just 0/140 ☺️

Comment on lines 29 to 44
const handleSubmit = (event) => {
event.preventDefault();

if (message.length === 0) {
setError("Message cannot be empty.");
return;
}
if (message.length < minLength) {
setError(`Message must be at least ${minLength} characters long.`);
return;
}
if (message.length > maxLength) {
setError(`Message must be no more than ${maxLength} characters.`);
return;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good way of handling different scenarios!

src/components/ThoughtItem.jsx Outdated Show resolved Hide resolved
Copy link
Contributor

@dzc1 dzc1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great Job Mai!

loving to see the topLevel app.jsx comp logic and api calls that are then passed down through props! Great approach as far as implementing the requirements of the project. I will leave you 1 piece of feedback which is related to your function called fetchThoughts on your app.jsx file on line 21. The function structure is great with 1 extra layer that you can add that will enhance it's power. Which is using the async/await syntax. This way you effectively run this call which is calling an 'outsde' resource .

const fetchThoughts = async () => { await fetch("https://happy-thoughts-ux7hkzgmwa-uc.a.run.app/thoughts") .then((response) => response.json()) .then((data) => setThoughts(data)) .catch((error) => console.error(error)); };
.

This way slight change brings a lot of power.

Great job!

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.

3 participants