How to dispatch a redux action #898
Replies: 1 comment
-
zustandPeople: async (something) => {
// you can dispatch an action as you have redux `store` globally.
store.dispatch({ type: 'GET_PEOPLE' })
}, |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
SeongwoonHong
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello.
little background, i'm using Zustand for a feature A, and I use redux for global state management in my app.
so here's an example code
And imagine, there's a People redux store and if you dispatch an action "GET_PEOPLE" it calls a relevant api and saves the response to People in redux store.
but when I call "zustandPeople" function, i want to do the same thing for some reason.
how do I do that? I know there's a redux middleware but it seems to only work with the specific reducer you pass to redux middleware?
Beta Was this translation helpful? Give feedback.
All reactions