Sign Up
Go Pro Sign Up Login

Buy Now and unlock this series

$

49

.99

yours forever

Become a Pro and unlock everything

$

24

.99

per month

Custom Snipcart Hook

We were able to successfully get Snipcart up and running on our original app, but as we might have noticed, we lose some of the functionality as we navigate between our new dynamic pages due to the clientside route changes. To solve this, we're going to learn how to create a custom React hook that we can use globally with the Context API that allows us to tap into Snipcart's state directly in order to make sure we're always displaying accurate and up-to-date order details.

Downloads

Become a pro to download code and videos

Comments

Jac

about 1 month ago

Disregard previous comment, I was passing in the snipcart state into the snipcart context provider value prop incorrectly.

Jac

about 1 month ago

Having issues getting subtotal to update after implementing the useSnipcart hook. It seems the data for cart & subtotal is coming in after the Header component has rendered and the state is not updating as expected.

Want to join the conversation?

Become a Pro member today!