Creating a simple Vuex application
We will start a fresh new application to learn the basics of Vuex. Let's get started.
Let's first create a new application:
$ vue init webpack vuex-tutorialThe preceding code snippet will ask you few questions about the application setup. You can choose what you want to keep. I will go with the following configuration:

After the installation, navigate to the project directory:
$ cd vuex-tutorialThe next thing to do is to run the following command:
$ npm installAfter that, run the following command:
$ npm run devThe preceding command will spin up your server and open a port in localhost:8080.
Installing Vuex
The next step is to install vuex. To do that, run the following command:
$ npm install --save vuexSetting up Vuex
Now, let's create a store folder to manage the vuex in our application.
Creating a store file
In the src directory, create a store folder and store.js file. Then, add the following to the store.js file:
import Vue from 'vue' import Vuex from 'vuex' ...