Actions

Actions are what we use to mutate the state. In zoov design, actions must be simple. One action do one mutation is most recommended

🙅‍♂️ Do not use async functions in actions

🙆‍♂️ Use Simple sync mutations in actions

toggleCheck: (state) => state.checked = !state.checked

🙅‍♂️ Do not mutate multi values in actions(Most cases)

🙆‍♂️ Use composed actions in methods

module
  .actions({
    ...
  })
  .methods(({ getActions }) => ({
    complexMutation: () => {
      getActions()...
      getActions()...
    }
  }))

Last updated