Skip to content
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

When to use mutations (and not plain functions) #31

Closed
dkzlv opened this issue Feb 6, 2024 · 0 comments · Fixed by #36
Closed

When to use mutations (and not plain functions) #31

dkzlv opened this issue Feb 6, 2024 · 0 comments · Fixed by #36
Labels
documentation Improvements or additions to documentation

Comments

@dkzlv
Copy link
Member

dkzlv commented Feb 6, 2024

This may be another good topic for documentation, but broadly speaking you want to use mutations in 2 major cases:

  1. you use those loading and error values in the store. Basically, it runs a promise for you and gives some sugar on top of it.
  2. you want to optimistically update cache beforehand (mutations give a good sugar for that as well).

If you don't need either, just go with a good ol' function! Mutations don't really give you any added benefit

@dkzlv dkzlv added the documentation Improvements or additions to documentation label Feb 6, 2024
@dkzlv dkzlv mentioned this issue Apr 3, 2024
7 tasks
@dkzlv dkzlv closed this as completed in #36 Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant