I am struggling to understand the concept of mutations in Vuex. All I've found online is that
The only way to actually change state in a Vuex store is by committing a mutation
but I could easily change the state directly within a component, for example like this:
computed: {
message: {
get() {
return this.$store.state.message
},
set(newmessage) {
this.$store.state.message = newmessage
}
}
}
(the complete example is here)
Writing mutations imply a lot of boring boilerplate code so why should I use them?
Is there anything wrong about my example?
Thanks!