How to use global state or variable in Vue.js (Simplest Vue.js Tutorial)
We love Reactjs, but it is indeed too complex when you need to call a global variable. So can Vue.js make it more simple than redux? Let’s have a look together! Before we start First I want you to have a basic understanding of Vue, you need to know how to use Vue CLI to create an empty project. Then you have to understand the basic structure of a Vue project, I mean template, script, CSS. Finally, I need you to take a look at https://medium.com/js-dojo/vuex-2638ba4b1d76 Basic Concepts State It’s nothing but as same as the Reactjs state. It’s a global variable, where saves the data that affect the view of your website. Mutations In this section, you define those scripts that change the state . Actions You should put every asynchronous operation in it, for example: fetch API . Read More Actions | Vuex Actions are similar to mutations, the differences being that: Instead of mutating the state, actions c