Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 1 year ago

ProDuct List With Cart Using React+Vite

accessibility, airtable, animation
Rahana Suleiman•190
@Rahana23
A solution to the Product list with cart challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


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

Am most proud of been able to complete this project, and I would ask for help sooner so as to not waste too much time stuck on one project.

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

One of the main challenges I encountered was an error related to React's context API. Specifically, I was getting the error: "useCartContext must be called within CartProvider." This was happening because I had forgotten to wrap my App component with the CartProvider. Without this provider, the useCartContext hook could not access the context values correctly, which led to the error.

I realised that the useCartContext hook could only work if it was inside a component tree that was wrapped by the CartProvider. To fix this, I made sure to wrap the entire App component with CartProvider, ensuring that all child components could access the context values.

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

Specific Areas I Would Like Help With: 1.Context API Optimisation: Although I managed to resolve the issue with the CartContext, I would appreciate help in ensuring that I’m using the React Context API in the most efficient way. Specifically, I want to know if there are better patterns for managing complex state, especially with the cart functionalities (like adding/removing items or updating quantities).

2.Error Handling: I would like some guidance on how to better handle errors in my app. While I’ve implemented the useCartContext with a proper error message when the provider is missing, I’m not sure if I should add additional error boundaries or other error-handling mechanisms to make the app more robust.

3.Component Structure and Reusability: I’d also like advice on the structure of my components. I feel like some of them could be made more reusable or organised better. For instance, making the Product and ProductList components more modular or easier to scale in case the project grows.

4.CSS and UI Consistency: Lastly, I’d appreciate feedback on how to improve the styling of the app. While I’ve used CSS modules for styling individual components, I’m not sure if my approach is consistent or scalable for larger projects. Any advice on best practices for organising styles and improving responsiveness across devices would be really helpful

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Rahana Suleiman's solution.

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner
  • Use cases

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License