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