Pinia notes
Pinia is a new state management library to adapt the Composition API feature in Vue 3.
The differences between Pinia and Vuex are:
Firstly, module mechanisms are different: In Pinia, every module is an independent store. Therefore, there are no modules
and namespaced
in Pinia. Instead, we use different stores when using different modules.
Then, Pinia rewrites their devtool implement. As a result, no mutations
exists in Pinit. We only need to call actions
to change the state. Talking to state
, you can even change state
without accessing actions
. I don't recommend it, though.
Thirdly, you import store instances when you want to import store instead of using strings.
Finally, you can use setup functions to arrange store in order to integrate with composition API.