Course lesson

Implement Cart Functionality for a Store with React Context

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

Duration
7 min
Access
Free
Transcript
Retained from source evidence

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.