Skip to content

Nikita w1 react #4

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

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

Conversation

NStefanchuk
Copy link

@NStefanchuk NStefanchuk commented Jun 16, 2025

https://ecommerce-react-w1.netlify.app/

  • A product list that displays all of the products in the all-products file. Note: the site is responsive, so have a look at the breakpoints in the deployed example project.
  • A category list that displays all of the categories in the all-categories file at the top of the page
  • If the user clicks on a category only the products that have that category in their category property should be displayed on the screen. Note: The categories listed in the product objects do not match up exactly with the categories in the categories list. You will have to find a solution to this without editing the files
  • There should only be 1 category active at a time and the user should see which category is selected.
  • You need to deploy your app somewhere (using something like netlify) and put the link in your PR!

@ChingHsun ChingHsun self-assigned this Jun 29, 2025
Copy link

@ChingHsun ChingHsun left a comment

Choose a reason for hiding this comment

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

All the implementations meet the standards and requirements. However, There is a console error showing up, though. Still might to fixed before approved

@@ -0,0 +1,24 @@
import React from 'react'

Choose a reason for hiding this comment

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

Since React 17 and newer versions with the new JSX transform, explicitly importing React in every file is no longer necessary.

Suggested change
import React from 'react'

import categories from '../fake-data/all-categories'

const CategoryList = ({ selectedCategory, setSelectedCategory }) => {
console.log('selected:', selectedCategory)

Choose a reason for hiding this comment

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

Suggested change
console.log('selected:', selectedCategory)

While developing, you might find it helpful to install the React Developer Tools extension:
https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi

This tool allows you to easily inspect React component props and state directly in the browser, without needing to use console.log.

Comment on lines 13 to 15
className={`${
selectedCategory === item ? 'category-item active' : 'category-item'
}`}

Choose a reason for hiding this comment

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

Suggested change
className={`${
selectedCategory === item ? 'category-item active' : 'category-item'
}`}
className={`category-item ${
selectedCategory === item ? 'active' : ''
}`}

import ProductCard from './ProductCard'

const ProductList = ({ selectedCategory, setSelectedCategory }) => {
console.log(selectedCategory)

Choose a reason for hiding this comment

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

Suggested change
console.log(selectedCategory)

!selectedCategory
)
.map((item) => (
<ProductCard item={item} />

Choose a reason for hiding this comment

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

Suggested change
<ProductCard item={item} />
<ProductCard item={item} key={item.id} />

The key prop needs to be placed on the outermost element returned by the .map() function. In this case, that means adding key to the component itself.
Screenshot 2025-06-29 at 05 07 51

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