Francois
Francois

Reputation: 332

About VueX good mutation practice

With a VueX store split up in modules, is it good practice to have a mutation in one module perform changes in a state from another module ?

I have a strong feeling that it is not and that module state should be modified only by mutations from within that same module. Is that right ?

Upvotes: 0

Views: 88

Answers (1)

kissu
kissu

Reputation: 46604

This is more of an opinionated question and it's hard to be answered without any concrete use-case nor code, but it is totally fine to interact between modules. It can be done via root, hence if it's here, it's not an anti-pattern.

It all depends of your codebase.

https://vuex.vuejs.org/api/#dispatch

Upvotes: 2

Related Questions