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

homework3 -class45-sanazzarei #37

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

Conversation

sanazzarei
Copy link

No description provided.

setFavorites([...favorites, productId]);
}
};
console.log(favorites);

Choose a reason for hiding this comment

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

this can be removed?

}

if (error) {
return <div>Sorry, we have an error: {error}</div>;

Choose a reason for hiding this comment

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

good job letting the user know about the error!

Comment on lines +26 to +27
} catch (error) {
console.error("Error:", error);

Choose a reason for hiding this comment

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

I think lines 18-19 already handle the error, you might not need this?

Copy link
Author

Choose a reason for hiding this comment

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

i thought response.ok checks if the HTTP request was successful, while the catch block handles any other potential errors during the process.

}

const { data, isLoading, error } = useFetch(url);
const products = data;

Choose a reason for hiding this comment

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

why the rename to products? If it's to make it more clear maybe the useFetch should export products instead of data. this is just a suggestion, no need to change

Choose a reason for hiding this comment

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

I think this folder can be removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants