Last Modified: 28.04.2022
Pinia is sate manager and library for Vue.js applications. It servers as a centralized storage for all app components and ensures data change/mutation predictability according to specific rules.
You can find more about Pinia 4 and the state management pattern at Pinia website.
Starting from version Vue 3, Vue developers have declared that Pinia is a recommended storage solution.
If you have previously used Vuex, then you can switch to Pinia in few steps.
Advantages and disadvantages compared to Vuex
- Simplified layout for handling storage model: instead of
mutations, only one type –
- Simple modular implementation:
- New notation compared to Vuex.
- Global module registration. Necessitates control of module naming within the complete project and extra data manipulations for several app copies.
- You need pre-activate Pinia before launching the app to be able to handle storage outside the Vue application.
- Minimal integration with VueDevTools, unavailable import/export and Time travel features.