Answer the question
In order to leave comments, you need to log in
Business logic in Vuex?
Is it correct to store application business logic in vuex? And where is it better to do it, action, mutations?
Answer the question
In order to leave comments, you need to log in
If the application is only a client application, then yes, do it in actions. If the client-server and the server are not stupid storage, then you need to wrap the logic on the server (well, except for primitives like amount = price * quantity).
I do not really understand the combination "to store business logic". I know that it can be implemented in different ways, but how to store it?
Vuex is a good place to store data that is required in many places in an application.
Well, then:
actions/mutations - for changing this data,
getters - for obtaining derivatives from this data.
And, yes, it is not at all necessary to do all the work with data through vuex. It is often more convenient for a component to store its state inside itself and not show it to anyone else.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question