November 2017
Beginner to intermediate
398 pages
8h 42m
English
The main piece of the store is its state. It represents the data shared across the components of your app. The first principle is--this is the single source of truth for your shared data. Since components will all read data from it, and it will always be right.
For now, the state will only have a user property, which will contain the logged user data:
const store = new Vuex.Store({ state () { return { user: null, } }, })
Also, the next very important principle is--the state is read-only. You shouldn't modify the state directly, or else you lose the benefits of using Vuex (which is to make the shared state easy to reason about). If ...
Read now
Unlock full access