Vuex in a nutshell
Vuex is a state management solution that is tailored specifically for Vue applications. As mentioned, it is inspired by Flux. You can use Vuex as a centralized store for the state, which is shared between components of your application. It has rules to ensure that the state can only be changed in a predictable way.
As you can see in Figure 11.1, in Vuex data flows in one direction. Usually, it starts from a Vue component, which dispatches an action that can commit a mutation and only the mutation can make changes to the state, which live inside a store. The store is the center of every Vuex application. Different from localData we saw earlier, Vuex stores are reactive. That is, the changes made to the store through a mutation ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access