E-commerce with #Directus and #Nextjs – [11] – Mini Cart and #Zustand

In this episode we are going to create a mini cart for our e-commerce site using Zustand state management library.

But we are going to have to change some things that we created in the previous episode to make this work because I miscalculated a bit how this is supposed to work. But those are going to be just small changes.

And you know… these things happen in software development, sometimes you have to change your approach mid way if your assumptions were incorrect or you haven’t thought things through, which I obviously did not.

We are also going to introduce a bit of state management to our app, which I’m not very happy about because I thought we would be able to rely solely on React Query for that, but turns out that we can’t, or maybe I’m missing something and that is why it’s not working properly.

I will show you what I mean during this episode.

But this is not all bad, because I got to play with Zustand – a very light weight state management library, which as you will see is a joy to use.

### Code used in this video

https://bit.ly/3tHGYCs

### You can support my work on Patreon

https://patreon.com/watchlearn

### Follow me on Social Media

Github: https://github.com/ivandoric
Twitter: https://twitter.com/ivan_doric
Instagram: https://www.instagram.com/watchlearntuts
Facebook: https://facebook.com/watchlearntutorials