Vuex vs Pinia

4/26/2022

Just go learn Pinia. It’s pleasant and fun, all the things I wish Vuex was. Not knocking Vuex they did the best with what that had, but Vue 3and Pinia makes me sad for all the legacy code bases that can’t be immediately switched to Pinia.

It’s the next generation of state management and takes JavaScript closer to what you can do out of the box with Flutter.

Vuex always bothered me with how many steps were required to do anything and how non-obvious things were. Especially how certain strings needed to match methods names in such a way the compiler couldn’t really help out and you only found out at runtime that things were not setup perfectly. All that’s gone with Pinia, no more magic strings and the compiler (and IDE) will find more issues before you even build for the first time.

Pinia works the way your would normally write code, no more mutations, actions dispatches and boilerplate, it’s less code and less learning to do the same thing. For the same effort you’ll know Pinia better, write less code and spend less time debugging. It’s like having a super power, or as I’d say it’s the way state management should have always been. No more jumping through the hoops put in place my javascript.