-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Update getter docs #601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update getter docs #601
Conversation
Add possibility to return functions in getters (#598)
return getters.todos.find(todo => todo.id === id) | ||
} | ||
// function syntax | ||
getTodoById: function(state, getters){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? I feel only the arrow function example is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I didn't I know you could do this with getters until I saw this commit. I'm sure many like myself will also benefit from this example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this example has the same meaning as the above example, I'm still not sure why we need both the arrow function and normal function version in Vuex docs.
@@ -61,6 +61,27 @@ computed: { | |||
} | |||
``` | |||
|
|||
You can also return functions in getters: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if there is a statement that describes this pattern is for passing some arguments to getters. 🙂
more detailed description and removed function syntax
Added a bit more details on possible uses to the description |
Thanks! |
Add possibility to return functions in getters (#598)