Pinia is the next generation of lightweight status management libraries with the following benefits:

  • Full TypeScript support
  • Full type label support
  • Extremely lightweight and about 1KB in size
  • The Actions configuration item in the Store can perform synchronous or asynchronous methods
  • Modules do not need to be nested and can declare multiple stores
  • Support Vue DevTools, SSR and Webpack code split

Some people may ask, why do we need a new framework when we already have Vuex? So let’s look at the disadvantages of Vuex:

And take a look at the Rfcs proposal for VEX5: (Github.com/vuejs/rfcs/… )

Translation:

  1. Support for the Options API and Composition API
  2. There’s no mutations, just state, getters, and actions
  3. There are no nested modules
  4. Better typescript support
  5. Automated code differential

We’ll find that Pinia fits in well with the Vuex5 proposal, and Pinia’s author is one of the key Vuex developers. Some time ago, Utah University also named Pinia in the “Front-end Early Chat”, indicating that there is a certain reference value. And learning Pinia now is like learning Vex5 ahead of time, which is well worth it.

Because Pinea is lightweight and small, it is suitable for small and medium-sized applications. It is also suitable for low-complexity vue.js projects. Using Vuex for small and medium vue.js projects is overdone because it is heavy and has a significant impact on performance degradation. Therefore, Vuex is suitable for large-scale, highly complex vue.js projects.

In order to learn about Pinia, I have written an open source project for teaching demonstrations as follows:Gitee.com/MTrun/pinia… GIF is:

This project has been open source on the code cloud, the source section of the reference to some articles on the nuggets. This is a very useful and intuitive project to learn pinia, please be sure to have a look, by the way, click on the star. Thank you

If you are interested, you can join in the construction