title: Vuex unregisterModule what does it do?
body: <p>I'm a bit confused with what <code>unregisterModule</code> is actually doing.</p>
  
  <p>If we have a module like so:</p>
  
  <pre><code>{
      state: {
          page: 1
      }
  }
  </code></pre>
  
  <p>Then un/register it dynamically:</p>
  
  <pre><code>beforeCreate() {        
      this.$store.registerModule('items', store);
  },
  
  beforeDestroy() {
      this.$store.unregisterModule('items');
  },
  </code></pre>
  
  <p>If we make a change to <code>page</code> navigate a way (which triggers <code>unregister</code>) then navigate back.</p>
  
  <p>It seems the state persists? I would think <code>unregister</code> completely kills the module and all data, states, etc?</p>
  
  <p>I can make the state a function like so:</p>
  
  <pre><code>{
      state() {
          return {
              page: 1
          }
      }
  }
  </code></pre>
  
  <p>But, then it still doesn't change the question then of what does <code>unregisterModule</code> actually do then?</p>
  
  <p>Also does it mean I would either have to change all my state objects into functions or have some kind of reset method on unregister. This seems quite pointless, what am I missing here?</p>