0

I read an example about getters in Vuex. Getters function has 2 parameters but only need to pass 1 parameter. What actually happen ? How do i write a custom function that have the same ability.

Delcaration:

getters: {
  // ...
  getTodoById: (state) => (id) => {
    return state.todos.find(todo => todo.id === id)
  }
}

Using:

store.getters.getTodoById(2)
  • This question is a duplication of https://stackoverflow.com/questions/32782922/what-do-multiple-arrow-functions-mean-in-javascript – blaz May 15 '19 at 07:02
  • Possible duplicate of [What do multiple arrow functions mean in javascript?](https://stackoverflow.com/questions/32782922/what-do-multiple-arrow-functions-mean-in-javascript) – blaz May 15 '19 at 07:03

0 Answers0