Hi most of the react developers would find dvaJS
and umiJS
, heaven for state management and application development. Dva is elm based state management tool that use react-redux
for state management.
Q: How to access DVA Store in UMI application, outside the component or without connect
?
Q: How to dispatch DVA Store in UMI application, outside the component or without connect
?
Answer
Q: How to access DVA Store in UMI application, outside the component or without connect
?
A: https://v2.umijs.org/guide/with-dva.html#how-to-access-store-or-dispatch
It says use:
window.g_app._store
Q: How to dispatch
DVA Store in UMI application, outside the component or without connect
?
A: https://v2.umijs.org/guide/with-dva.html#how-to-access-store-or-dispatch
It says use:
window.g_app._store.dispatch('namespace/action')
Bonus:
Q: How to get state of
DVA Store in UMI application, outside the component or without connect
?
A: https://v2.umijs.org/guide/with-dva.html#how-to-access-store-or-dispatch
It says use:
window.g_app._store.getState()
Available Functions:
asyncReducers: {}
dispatch: ƒ ()
getState: ƒ f()
replaceReducer: ƒ (n)
runSaga: ƒ ()
subscribe: ƒ subscribe(listener)
Recommended: Instead of directly using it, write a Util that exports these functions.
Refer to https://stackoverflow.com/questions/63073047/how-to-access-dva-store-in-umi-application/63073048#63073048 for discussion on StackOverflow
Top comments (0)