MapState
MapState is a helper function provided by Vuex, the state management library for Vue.js. It generates computed properties that expose the store’s state to a component, allowing components to read reactive data from the Vuex store without manually writing boilerplate getters.
The primary use of mapState is in the options API of a component. It is typically spread
MapState supports several forms. It can take an array of strings to map multiple top-level state properties
In Vue 2 and Vuex 3/4, mapState is commonly used as ...mapState(['count', 'userName']) or ...mapState('auth', ['token'])
See also mapGetters, mapActions, and mapMutations as related Vuex helpers.