-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: main
Are you sure you want to change the base?
Conversation
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.
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' |
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.
Since React 17 and newer versions with the new JSX transform, explicitly importing React in every file is no longer necessary.
import React from 'react' |
import categories from '../fake-data/all-categories' | ||
|
||
const CategoryList = ({ selectedCategory, setSelectedCategory }) => { | ||
console.log('selected:', selectedCategory) |
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.
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
.
className={`${ | ||
selectedCategory === item ? 'category-item active' : 'category-item' | ||
}`} |
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.
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) |
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.
console.log(selectedCategory) |
!selectedCategory | ||
) | ||
.map((item) => ( | ||
<ProductCard item={item} /> |
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.
https://ecommerce-react-w1.netlify.app/
all-products
file. Note: the site is responsive, so have a look at the breakpoints in the deployed example project.all-categories
file at the top of the pagecategory
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