The home for developers
Track your course progress, manage projects, and find your dream job - all in one place.
Start Your Free Trial7 Day Free Trial. Cancel Anytime.
SitePoint Premium
In single-page applications, the concept of state relates to any piece of data that can change. An example of state could be the details of a logged-in user, or data fetched from an API.
Handling state in single-page apps can be a tricky process. As an application gets larger and more complex, you start to encounter situations where a given piece of state needs to be used in multiple components, or you find yourself passing state through components that don’t need it, just to get it to where it needs to be. This is also known as “prop drilling”, and can lead to some unwieldy code.
Vuex is the official state management solution for Vue. It works by having a central store for shared state, and providing methods to allow any component in your application to access that state. In essence, Vuex ensures your views remain consistent with your application data, regardless of which function triggers a change to your application data.
In this book, I’ll offer you a high-level overview of Vuex and demonstrate how to implement it into a simple app.
Michael Wanyoike
2 total