Onyx
Onyx

Reputation: 5762

When using Vuex, am I meant to stick to one store or do I want to have multiple stores for different logic?

Currently I'm figuring out Vuex and my store has started becoming quite big with many actions. Am I meant to separate different logic in different stores? For example, 1 store that would contain all authentication logic and another store for game play logic ( if I'm making something like a game ), etc? Or should I just stick everything into one store?

If I were to make more stores, how should I name them ( so that I am following a convention )?

Is there anything else I'd need to know if I were to split the logic into more than one stores?

Upvotes: 0

Views: 96

Answers (1)

Daniel
Daniel

Reputation: 35684

You should only use a single store, but you can (and in your case should) use modules.

https://vuex.vuejs.org/guide/modules.html

Note the namespacing option that you can use to resolve naming conflicts

Upvotes: 3

Related Questions