Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Product Cart | React + Vite + CSS Modules

P

@delroscol98

Desktop design screenshot for the Product list with cart coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


What are you most proud of, and what would you do differently next time?

I am most proud of my data management and distribution using useContext and useReducer for the first time in my own project is a massive achievement for me.

What challenges did you encounter, and how did you overcome them?

Walking into this project I knew it was going to be difficult, despite the functionality and the user experience seeming very simple, I knew that I was dealing with data fetching and more complex state management. Therefore the following mental notes were made:

  1. The dessert list is only rendered and not used anywhere else, and therefore needs to be fetched and stored in some useState variable
  2. The cart list is a bit more complex and needs to be updated depending on user interactions, plus it needs to be display when the user confirms their order, this calls for useContext
  3. Due to mulitple state updates happening at a click of a button, useReducer is a necessity
  4. Since I was fetching data, useEffect was needed coupled with useCallback to avoid infinite re-renders

What specific areas of your project would you like help with?

If there are any components that are able to be abstracted, please let me know!

Community feedback

Quang 350

@progressive-newbie263

Posted

i am speechless haha. You sir did a really great job, much better than mine, so i can't give any helpful comment to you. The useReducer felt like a miracle to an also newbie at React like me. Keep up the great work man.

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord