Go Pro Sign Up Login
0 days 0 hrs 0 min 0 sec

Summer Sale

50% off Level Up Pro until you unsubscribe.
Get access to ALL 128 courses on Level Up Tutorials

This is your last chance to get Level Up Pro for $145/year.

or Learn More
Moon Moon

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

Mike

9 months ago

Im having an issue with deploying with netlify. It was working previously but now I am being hit with an error when netlify tries to run npm run build.

Jac

about 1 year ago

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

Jac

about 1 year 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!