0

I find this expresion in some project using vuex:

[SET_BREADCRUMB](state, payload) {
      state.commit(SET_BREADCRUMB, payload);
    }

Please someone explain me what is here? Usually [] this is array notation. But i don't understand why is followed by () like a function.

wangdev87
  • 8,611
  • 3
  • 8
  • 31
  • You’re probably talking about this pattern? https://vuex.vuejs.org/guide/mutations.html#using-constants-for-mutation-types – deceze Feb 11 '21 at 08:49
  • It is a commonly seen pattern to use constants for mutation types in various Flux implementations. This allows the code to take advantage of tooling like linters, and putting all constants in a single file allows your collaborators to get an at-a-glance view of what mutations are possible in the entire application: – Oleksii Zelenko Feb 11 '21 at 09:07

0 Answers0