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