Skip to content

@pinia/root / pinia / MutationType

MutationType

Possible types for SubscriptionCallback

Enumeration Members

direct

ts
direct: "direct";

Direct mutation of the state:

  • store.name = 'new name'
  • store.$state.name = 'new name'
  • store.list.push('new item')

patchFunction

ts
patchFunction: "patch function";

Mutated the state with $patch and a function

  • store.$patch(state => state.name = 'newName')

patchObject

ts
patchObject: "patch object";

Mutated the state with $patch and an object

  • store.$patch({ name: 'newName' })

Released under the MIT License.