nanostores/query

When to use mutations (and not plain functions)

dkzlv opened this issue · 0 comments

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