Quick Full Pinia Course

OnlyKiosk Dev Tech
Geek Culture
Published in
25 min readMar 4, 2022

--

VueX is now in maintenance mode, meaning it is still maintained but won’t receive new features. It is only a matter of time before it is completely replaced by its successor — Pinia.

Pinia does the same job as VueX — retrieving data from the backend api via Ajax and providing the same data for to all components. All component read from and write to the same set of data. Operating the same set of data guarantees data consistency.

Pinia & VueX

Exchanging data with the backend api is async. Exchanging data with components, however, is synchronous. The backend api exchanges data with action methods; components read from and write to state properties.

Async & Sync

In VueX, an action method cannot directly modify a state. It has to go through a mutation method. To trigger an action method, you need to “dispatch” it, and to trigger a mutation method, you need to “commit” it.

The VueX module is more like an afterthought. Only states are namespaced by default. Getters, mutations, and actions are namespaced in a really bad way.

--

--