Calling async actions from an action #955
-
This is a general question to make sure I'm not starting on a bad path with zustand. I currently am using a context for my entire app, so I have some spots where I set state then use a callback to call some other async APIs after a user performs an action. it looks like this in the context: setState({ someState: true }, async () => {
Promise.all([this.otherAction1, this.otherAction2])
}); and I plan to replace it with this in the store: set({ someState: true })
await Promise.all([
get().otherAction1(),
get().otherAction2()
]); Thank you! |
Beta Was this translation helpful? Give feedback.
Answered by
dai-shi
May 14, 2022
Replies: 1 comment
-
I don't see any issue so far. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
martincalvert
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't see any issue so far.