In this Vue.js tutorial, we’ll look into how we can use higher order functions to create dynamic getters in Vuex. Dynamic getters allow us to pass arguments to a getter. This is particularly useful if you want to query your store.
A common use case is to create a getter to find an item in the state using its id.
getProductById (state, getters) {
return id => {
return state.products.find(product => product.id === id)
}
}