mapMutation with dynamic store
-
I am writing a custom component so that I can reuse it with different stores. I am trying to use mapMutation like this, where storeName is a prop passed from the parent component
methods: { ...mapMutations(`${this.storeName}`, ['someVariable']), }
But, this is generating the below error,
Uncaught TypeError: Cannot read property ‘storeName’ of undefinedAny suggestion will be helpful, thanks
-
@technowebs said in mapMutation with dynamic store:
…mapMutations(
${this.storeName}
, [‘someVariable’]),I think it goes like this:
...mapMutations('moduleName', ['mutationName']),
if you store the module name in the component:
...mapMutations(this.storeName, ['mutationName']),