1. 20
    Implement Cart Functionality for a Store with React Context
    6m 34s

Implement Cart Functionality for a Store with React Context

InstructorShadid Haque

Share this video with your friends

Send Tweet

We want visitors to our site to be able to browse our products and add them to a cart for purchase.

To do this we'll create React Context to expose a cart value to our application so we can use it where we need to. This context will handle adding items and deleting items from the cart. We will hook up the add functionality to buttons on our product cards as well as display how many items we have in the cart in our Nav bar.

~ a year ago

I'm having some trouble with my application. My queries/mutations don't return any data, it's like they are wrong, but when I test in GraphQL playground, it works. I cannot see any off my pages bc of that. For example, in my main page localhost:3000/ I get the error "TypeError: Cannot read properties of undefined (reading 'map')" like I didn't have any products to show. Can you help me? My project: https://github.com/luanavfg/my-market-place

Shadid Haqueinstructor
~ a year ago

Hey absolutely. I will take a look at your code. Thank you for pointing out.

~ a year ago

Hey, Shadid! I hope you're doing well. Did you get a chance to look at my code? I still haven't been able to figure out what's happening.