* Make mutations responsible for updating one piece * update history from mutations * rename Counter to CounterControls * remove unnecessary commit call
@@ -1,9 +1,9 @@
import Vue from 'vue'
import store from './store'
-import Counter from './Counter.vue'
+import CounterControls from './CounterControls.vue'
new Vue({
el: '#app',
store,
- render: h => h(Counter)
+ render: h => h(CounterControls)
})
@@ -1,5 +1,9 @@
-export const increment = ({ commit }) => commit('increment')
-export const decrement = ({ commit }) => commit('decrement')
+export const increment = ({ commit }) => {
+ commit('increment')
+}
+export const decrement = ({ commit }) => {
+ commit('decrement')
export const incrementIfOdd = ({ commit, state }) => {
if ((state.count + 1) % 2 === 0) {