How to get arguments passed to getters
See original GitHub issueHow to get arguments passed to getters
for example:
const state = {
users:[{id:1},{id:2}]
}
const getters = {
getUser: state => id => state.users.find( el =>el.id == id )
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
vuexjs getter with argument - Stack Overflow
You can pass arguments to getters by returning a function. This is particularly useful when you want to query an array in the...
Read more >Pass arguments to a Vuex getter - Jérémy Riverain
Passing arguments to a vuex getter is very useful. It makes them more powerful. However, the syntax to do it is quite tricky....
Read more >How to pass parameters to the function in getters #688 - GitHub
anybody knows if is possible to load getters in component using mapGetters? I mean, instead of this return this.$store.getters.search('foo'). do ...
Read more >Getters | Vuex
You can also pass arguments to getters by returning a function. This is particularly useful when you want to query an array in...
Read more >How to pass parameters to a Vuex store getter
It seem that it's not possible to pass parameters to a getter, when it's being mapped by mapGetters. I've declared normally my getter...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks a lot for this guys. May I suggest to include this example also in the project’s tests? I was googling everywhere for this, but couldn’t find the solution. Only when I wanted to create a new issue on this project, I’ve noticed this one.