Question 24
Given the following Vuex store setup.
const store = new Vuex.Store({ state: { counter: 0 }, mutations: { increment(state) { state.counter++; } }, actions: { async incrementAsync({ commit }) { await new Promise(resolve => setTimeout(resolve, 1000)); commit('increment'); } }});Assuming the store is correctly binded with a Vue app, what will be the correct behavior when the following code is executed?
this.$store.dispatch('incrementAsync');The increment mutation will be called immediately after the dispatch.
The state will be updated after the asynchronous operation completes.
The incrementAsync action will be executed synchronously, and increment will be committed before the promise resolves.
The action will be skipped since mutations cannot be called inside actions.