When to use mutations (and not plain functions)
dkzlv opened this issue · 0 comments
dkzlv commented
This may be another good topic for documentation, but broadly speaking you want to use mutations in 2 major cases:
- you use those
loading
anderror
values in the store. Basically, it runs a promise for you and gives some sugar on top of it. - 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