
In a small Vue app, data lives in components and travels through props and events. As the app grows, several screens start to need the same data: the signed-in user, a shopping cart, a set of filters, a list that one page edits and another displays. Passing that data through layer after layer of components gets fragile. Vuex was Vue's official answer to this problem for years. It is still running in a great many production applications, but it is no longer the recommended choice for new ones; that role has passed to Pinia.
This article explains what Vuex is, how it works, why the Vue team moved to Pinia, and how to plan a migration.
What is Vuex?
Vuex is a state management pattern and library for Vue.js applications. It provides a central store for the state that many components share, with rules that make every change to that state predictable. The official documentation says it draws on Flux, Redux and The Elm Architecture, but it is built specifically for Vue and uses Vue's own reactivity system, so components update automatically when the store changes.
Vuex was created by Evan You, the creator of Vue, and is released under the MIT licence. Its first package was published on npm on 6 December 2015. Vuex 2.0 shipped on 30 September 2016, the same day as Vue 2.0, and Vuex 4.0, aligned with Vue 3, followed on 2 February 2021. The most recent release, 4.1.0, dates from October 2022.
Today the Vuex documentation opens with a notice: the official state management library for Vue has changed to Pinia, which has almost the same or an enhanced API compared with what was planned for Vuex 5. Vuex 3 and 4 are still maintained, but new features are unlikely, and the docs recommend starting new projects with Pinia.
How Vuex works
A Vuex store is built from four concepts, and the rules between them are what make state changes traceable.
State. A single object that holds the shared data of the application. Because it is reactive, any component that reads it re-renders when it changes.
Getters. Derived values computed from the state, such as the number of items in a cart or a filtered list. They work like computed properties for the store.
Mutations. The only way to change state in a Vuex store is to commit a mutation. Mutations must be synchronous, so that the devtools can record the state before and after every change. A change made inside an asynchronous callback would be impossible to track reliably.
Actions. Actions hold the asynchronous work, such as calling an API. They do not change state themselves; they commit mutations when the data arrives. Components trigger them with store.dispatch, which returns a Promise.
As an application grows, a single store gets large, so Vuex lets you split it into modules, each with its own state, getters, mutations and actions. With namespaced: true, a module's names are prefixed by its path so they do not clash with other modules. In Vuex 4, components using the Composition API reach the store through useStore().
Key features
- A single source of truth for shared state, outside the component tree.
- Predictable changes: state changes only through committed mutations, which keeps a clear history.
- Devtools integration that records each mutation, with time-travel debugging.
- Modules and namespaces for splitting a large store by feature.
- Vue 2 and Vue 3 support through two release lines: Vuex 4 is aligned with Vue 3, while older Vue 2 applications run Vuex 3.
Where Vuex is used
- Existing Vue 2 applications, where Vuex was the standard choice for years and often sits at the centre of the codebase.
- Vue 3 applications migrated from Vue 2, which kept their store on Vuex 4 to limit the size of the upgrade.
- Large single-page applications with many modules, such as admin panels and enterprise dashboards built before Pinia became the default.
- Projects built on Nuxt 2, which shipped with built-in Vuex store support.
When to choose Vuex, and when not to
Keep Vuex when:
- The application works, the store is stable and there is no business reason to touch it. Vuex 3 and 4 are still maintained.
- You are in the middle of a Vue 2 to Vue 3 upgrade. Moving to Vuex 4 first keeps the store's API almost unchanged and lets you treat the state layer as a separate step.
- The team has deep Vuex knowledge, tooling and plugins built around it, and a migration would cost more than it returns for now.
Choose something else when:
- You are starting a new Vue application. The Vue team recommends Pinia, and new features will land there.
- You want strong TypeScript support without custom wrappers. Pinia is built around type inference; Vuex 4 requires your own type declarations for
this.$store. - The app is still on Vue 2, which reached end of life on 31 December 2023. The real decision there is upgrading Vue.js itself, and that is the natural moment to move the store too.
Vuex and its alternatives
| Option | Model | TypeScript | Status | Best fit |
|---|---|---|---|---|
| Vuex 4 | One store with modules, mutations and actions | Needs manual typing | Maintained, no new features | Existing Vuex codebases |
| Pinia | Many small stores, actions change state directly | Inferred types | Official recommendation | New and modernised Vue apps |
| Composition API state | Shared ref / reactive in composables | Native | Part of Vue | Small apps and simple shared state |
| Redux, Zustand | Stores for React | Good | Active | React applications, not Vue |
The comparison that matters is Vuex vs Pinia. Pinia began in November 2019 as an experiment in what the next version of Vuex could look like, and it turned out to implement most of what was wanted for Vuex 5. The main differences are that Pinia has no mutations, each store is its own module so there are no nested modules or namespaces, and types are inferred rather than declared. For React projects the equivalents are Redux and Zustand; they solve the same problem in a different framework.
Migrating from Vuex to Pinia
The Pinia documentation includes a migration guide. Its most useful point is that you do not have to migrate in one go: Vuex and Pinia can run in the same application while you move one module at a time. A typical plan:
- Upgrade the foundation. If the app is on Vue 2, move to Vue 3 first, with Vuex 4 as a temporary stepping stone. Current Pinia versions no longer support Vue 2.
- Map modules to stores. Each Vuex module becomes a Pinia store with its own id, which takes over the role of the namespace.
- Fold mutations into actions. Mutations no longer exist. Simple ones become direct assignments, the rest become actions, and actions drop their
contextargument in favour ofthis. - Replace cross-module access.
rootStateandrootGettersgive way to importing the other store directly. - Update components and the rest of the app. Components import the store they need instead of calling
useStore(), and code outside components, such as router guards, calls the store inside the function that uses it. - Replace plugins. Check whether each Vuex plugin, such as persistence, has a Pinia equivalent, or port it.
Unit tests in Vitest, written before and after each module moves, make the migration much safer.
How we use Vuex at Internative
We work with Vuex mainly in existing and legacy Vue applications. Our focus there is keeping them stable, improving performance and, when the time is right, planning the migration to a modern alternative such as Pinia.
If you run a Vue application that has fallen behind, on Vue 2 or on a store nobody wants to touch, our product modernization team can help you plan the upgrade step by step.
Frequently asked questions
What does Vuex mean?
Vuex is the name of the state management pattern and library made for Vue.js. It gives an application a central store for shared data and allows that data to change only through defined mutations, which makes changes predictable and easy to trace in the devtools.
Is Vuex deprecated?
Not formally, but it is in maintenance mode. The official documentation says Vuex 3 and 4 will still be maintained, but new features are unlikely, and Pinia is now the official state management library for Vue. Existing Vuex apps keep working; new projects should start with Pinia.
What is Pinia used for in Vue?
Pinia is the official state management library for Vue, the successor to Vuex. It holds state that several components share, in small stores that each have their own state, getters and actions. It has no mutations, works with the Composition API and infers TypeScript types without extra declarations.
Can Vuex and Pinia be used together?
Yes. The Pinia documentation says you can mix Pinia and Vuex in the same project during a migration. That lets a team move one module at a time and keep shipping, instead of rewriting the whole store in one release.
Keep reading
The articles that follow this one.



