Reputation: 10905
I was expecting that if I have a module that has namespaced:false
(which I think is also the default) then its state should be part of the "global" or "root" namespace and that I would be able to do " ...mapState('someStateAttribute')
and then refer to someStateAttribute
but it would seem that I must use ...mapState('modulename','someStateAttribute')
or else it does not work.
Is this just the case? or am I missing something?
Upvotes: 2
Views: 1574
Reputation: 135742
Have a look at mapState
's signature:
mapState(namespace?: string, map: Array<string> | Object<string | function>): Object
This means the first argument, namespace
, is optional. But if you provide a string as first argument, it will be the namespace
.
To achieve what you want you should do:
...mapState(['someStateAttribute'])
Upvotes: 2