Skip to content

Instantly share code, notes, and snippets.

@Raja0sama
Created March 19, 2021 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raja0sama/9318d9cb008cdaed2800e8dd935fb6d8 to your computer and use it in GitHub Desktop.
Save Raja0sama/9318d9cb008cdaed2800e8dd935fb6d8 to your computer and use it in GitHub Desktop.
Accessing App Reference in UMI for the store.
// import
import { getDvaApp } from 'umi'
// DVA store.
const store = getDvaApp()?._store
// function, this is how you can access dispatch
export function dispatch(action) {
return getDvaApp()?._store.dispatch(action);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment