-
Notifications
You must be signed in to change notification settings - Fork 7
Hadidreem17 w3 react #29
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?
Hadidreem17 w3 react #29
Conversation
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.2.11 to 5.4.6. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.4.6/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.4.6/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3. - [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md) - [Commits](micromatch/braces@3.0.2...3.0.3) --- updated-dependencies: - dependency-name: braces dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
robvk
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.
Good code, some small issues and one big issue:
- Again you have code in here that is not supposed to be here. Once you are ready with the project, come back and fix this because otherwise you will get into issues when working with others.
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.
Why is there a submodule here?
| function App() { | ||
| return ( | ||
| <FavouritesProvider> | ||
| <header className="navbar"> |
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.
Maybe nicer to have this as a
component?| const { id, title, image, price } = product; | ||
| const { favourites, toggleFavourite } = useFavourites(); | ||
|
|
||
| const isFavourite = favourites.includes(id); |
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.
I think this function can also be defined in the useFavourites hook. Then you keep all the functions around the favourites array in the same place
| className="fav-button" | ||
| onClick={() => toggleFavourite(id)} | ||
| > | ||
| {isFavourite ? "❤️" : "♡"} |
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 is risky, different Operating systems/browsers render it differently and some even can't render it. Best to use an .svg and then render that to be consistent.
| export function useFavourites() { | ||
| const ctx = useContext(FavouritesContext); | ||
| if (!ctx) { | ||
| throw new Error("useFavourites must be used inside FavouritesProvider"); |
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.
Good stuff, helps a lot with debugging if you make a mistake!
version Netlify : https://cozy-begonia-81d501.netlify.app/