-
Notifications
You must be signed in to change notification settings - Fork 7
Ahmad-React-w3-Assignment #31
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?
Ahmad-React-w3-Assignment #31
Conversation
6886964 to
77bcd75
Compare
sycons
left a comment
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.
Following were implemented:
- Copy over the assets folder to your ecommerce/src folder ✅
- A context that stores the id of all of the favourites of the user (not the whole object) ✅
- Heart clicked on product list page and product details page updates the favourites array in the context ✅
- Create a
useFetchcustom hook to reuse logis forloadinganderrorstates ✅ - Deploy app somewhere (like netlify) and add link to PR ✅
Requested improvements:
- Favourites page should list the products user has favourited
- Navigation bar at the top should handle routing between
/and/favourites - Fix linting error in FavouritesContext.jsx. I've added comment on the file. You can also run
npm run lintto view the linting errors.
| return ( | ||
| <nav className="navbar"> | ||
| <h1>Ecommerce</h1> | ||
| </nav> |
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.
There are no links here for the home and favourites pages here. The user needs a way to navigate to these pages.
Please have a look at how it works in the live version:
https://hyf-react-w3-example.netlify.app/
|
|
||
| <Routes> | ||
| <Route path="/" element={<Products />} /> | ||
| <Route path="/product/:id" element={<ProductDetail />} /> |
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.
Route for favourites page is missing.
| import { FavouritesContext } from "../context/FavouritesContext"; | ||
| import heartSolid from "../assets/heart-solid.svg"; | ||
|
|
||
| function Favourites() { |
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.
This component does not get rendered in the app at all.
| @@ -0,0 +1,21 @@ | |||
| import { createContext, useState } from "react"; | |||
|
|
|||
| export const FavouritesContext = createContext(); | |||
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.
Please fix this linting error "Fast refresh only works when a file only exports components. Move your React context(s) to a separate file."
https://ecommerece-33.netlify.app/