I'm curious about the use of mutation values within brackets in Vuex.
What does the code ""
represent?
export const SOME_MUTATION = 'SOME_MUTATION'
Is this just a constant name for a function? If so, why is it enclosed in brackets "[]"
?
Furthermore, when using it in the computed or method property, what is the reason for passing ["SOME_ACTION"]
instead of "SOME_ACTION"
?
...mapActions(["SOME_ACTION"]),
Example Code
export const SOME_MUTATION = 'SOME_MUTATION'
import Vuex from 'vuex'
import { SOME_MUTATION } from './mutation-types'
const store = new Vuex.Store({
state: { ... },
mutations: {
[SOME_MUTATION] (state) {
}
}
})