T
T
thehighhomie2019-08-17 18:41:44
JavaScript
thehighhomie, 2019-08-17 18:41:44

VueJS: mutation-types and action-types?

Guys, please tell me about mutation-types and action-types.
I saw that some people create mutation-types.js files and write mutation constants in it, and some also write action-types (constants for actions).
On the vuex website they write that this can help in large projects, however, for each module in the store I create files with constants for mutations and for actions (mutation-types.js and action-types.js) and this is a plus for me only that it is easier for me to distinguish in the component that these are functions from the store and not methods of the project instance.
And there are more minuses for me with this approach, it tires me to constantly import constants into the component for mutations and actions.
Tell me how it is generally desirable to add action-types.js with constants for actions along with mutation-types.js constants for mutations, or is one usually used?
PS: my application is an editor and in the components quite a lot of mutations and actions are called, there is not one thing that prevails.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kulakov, 2019-08-17
@kulakoff Vue.js

The answer will be banal - do as it is more convenient for you. If you don't see any reason to use it, don't use it. I have not yet found it convenient to do this in any project.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question