Static GitHub Issues

[2803] How to use store created in my module

prev: Nuxt error is static
next: validate( return false ) to jump my route instead of 404 ???

How do i use my-module store in my-app?

My module

// modules/my-module/store/index.js
import Vuex from 'vuex'

const createStore = () => {
  return new Vuex.Store({
    state: {
      counter: 0
    }
  })
}

export default createStore

My app

// pages/index.vue
<template>
  <div>
      <button>{{ counter }}</button>
  </div>
</template>

<script>
import { mapState } from 'vuex'

export default {
  computed: mapState([
    'counter'
  ])
}
</script>
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2432">#c2432</a>)</em></sub></div>