State for Vues
State management in Vue handles data shared across many components. Pinia is the official store library, where you define stores with state, getters and actions and use them from any component. A clear project structure, with folders for components, views, stores and composables, keeps larger apps manageable.
Stage: App Architecture · Part of the Vue roadmap · Last reviewed 19 November 2026
What to learn in State
- Define a Pinia store with state, getters and actions
- Use a store in components and keep its reactivity with storeToRefs
- Decide when state belongs in a component, a composable or a store
- Persist part of a store to local storage
- Organise a project into views, components, stores and composables
State interview questions
When should you use Pinia instead of local component state?
Use Pinia when several unrelated components need the same data, such as the logged-in user or a cart. Keep state local when only one component or its children use it, to avoid unnecessary global coupling.
How does Pinia differ from Vuex?
Pinia is the recommended store for Vue 3. It has no mutations, uses simple actions, offers better TypeScript support, and supports multiple small stores. Vuex is older and more verbose.
Where State fits in the Vue roadmap
State belongs to the App Architecture stage (intermediate level), which takes about 19 hours. Routing and state.