[Vuejs]-Vuex getters , mutations and setters in actions …?

3👍

As you can see in the official document

  1. Instead of mutating the state, actions commit mutations.
  2. Actions can contain arbitrary asynchronous operations.

Actions is the way you react to user’s interactions, this is where you notify the store something happens, then you can commit to change the state value in some properties, in actions, for example if user click on Sign in button, you will notify the store what inputs you have in components you may call something like this in your component
this.$store.dispatch('LOGIN', {username, password})
that is where action called.

Leave a comment