Vuex Getter Hook with parameters
<p>I defined a vuex getter function with parameters, the code is as follows: </p>
<pre class="brush:php;toolbar:false;">const getters = {
getProjectById: (state) => (id) => {
return state.projects.find(project => project.id === id)
}
}</pre>
<p>Now, I want to use this getter function in my component, but I can't find a way to pass parameters to the getter. </p>
<p>This is my getter hook computed property: </p>
<pre class="brush:php;toolbar:false;">computed: {
...mapGetters(["currentUserPhoto","getProjectById"])
},</pre>
<p>Is it possible to pass the Id parameter from the route to the "getProjectId" getter? If possible, what is the best approach? </p>