How it works...

The balance in the bottom is like a summary of the global state. With Vuex, we were able to affect other components by accessing the $store variable that gets injected in every component by the Vuex plugin. You can easily imagine how to use this strategy in a big application when you want to basically expand the scope of a variable beyond the component itself.

Some of the states may be local, for example if you need some animations or you need some variables to show modal dialogs for the component; it's perfectly okay to not put these values in the store. Otherwise, having a structured centralized state in one place helps a lot. In the subsequent recipes, you'll use more advanced techniques to exploit the power of Vuex better. ...

Get Vue.js 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.