Skip to content

Conversation

@Narpimers
Copy link

@crevulus crevulus self-assigned this Jul 3, 2025
Copy link

@crevulus crevulus left a comment

Choose a reason for hiding this comment

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

Hi Ilias,

Once again you've left things out of the project that are requirements from the README! Please make sure your work is complete before you submit it. This will be important in your career as a developer when you're fixing bugs and delivering features.

if (!product) return <div>Product not found</div>;

return (
<>
Copy link

Choose a reason for hiding this comment

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

You are missing a requirement from the README:

For the images in the product list as well as the product details page there needs to be a heart that if clicked will update the favourites array in the context.

🔴

const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);

useEffect(() => {
Copy link

Choose a reason for hiding this comment

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

You should be using your useFetch function here 🔴

.then(data => setProduct(data))
.catch(err => {
console.error("Error when receiving the product:", err);
setError("Couldn't upload the product");
Copy link

Choose a reason for hiding this comment

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

the user isn's trying to upload anything - could you make this message a little more accurate? 🟠


function Products({ products = [] }) {

if (!products.length) {
Copy link

Choose a reason for hiding this comment

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

Nice

: (allItems || []);

if (error) {
return <div className="error">Data upload error: {error.message || String(error)}</div>;
Copy link

Choose a reason for hiding this comment

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

Also not an upload 🟠

<NavBar />
</div>

{loading ? (
Copy link

Choose a reason for hiding this comment

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

This is a nested ternary and is not a good idea for readability and maintainability reasons: https://dev.to/junihoj/why-nested-ternary-operators-are-bad-practice-a-guide-for-developers-ki1 🟠

import { useContext } from 'react';
import { FavoritesContext } from '../Context/FavoritesContext';

const FavIcon = ({ productId }) => {
Copy link

Choose a reason for hiding this comment

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

Be careful with naming your components. a "favicon" is already a thing - it's the icon that shows in your browser tab. Plus, this component doesn't render an icon. The icon(s) are in svg files in your assts folder. This file renders a button that users can interact with, so something like FavButton would be better. 🔵

};

return (
<img
Copy link

Choose a reason for hiding this comment

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

It's important to use semantic HTML. Clickable elements should be buttons or anchor tags. This article is about divs but it applies to many elements: https://dev.to/kenbellows/stop-using-so-many-divs-an-intro-to-semantic-html-3i9i 🟠

@Narpimers
Copy link
Author

@crevulus Thank you so much! I made adjustments based on your comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants