title: VueJS - Accessing store data inside mounted
body: <p>I'm having trouble understanding the following:</p>
  
  <p>I have a <code>store</code> which contains variables needed for the application. In particular, there is a <code>globalCompanies</code> which stores:</p>
  
  <pre><code>globalCompanies: {
     current: [],
     all: [],
     currentName: "",
  }
  </code></pre>
  
  <p>Inside another component, I want to do the following:</p>
  
  <pre><code>mounted() {
     this.$store.dispatch( "fetchUsers" );
  
     var currentName = this.$store.state.globalCompanies.currentName; 
  
     console.log(currentName); 
  },
  </code></pre>
  
  <p>However, this just shows as empty. I know the value is there because I have <code>computed</code> which returns the <code>currentName</code> and it works fine inside the view itself. It just doesn't like the fact that it's in the mounted component. </p>
  
  <p>Where am I going wrong and what can I do to resolve this issue? I really need to capture the companies Name in order to use it for some real time events. </p>