Using react mobx actions from another stores inside components and other stores #2565
Unanswered
Gabotron-ES
asked this question in
Q&A
Replies: 1 comment
-
A simple store pattern , you can access any property from anywhere https://codesandbox.io/s/wispy-monad-c6m0y?file=/src/index.ts |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
in my react native app I want to use mobx for state management, my store is divided in multiple stores/files and since I want to be able to call a store actions from another stores I'm implementing a GlobalStore where I instantiate the other stores.
I want to be able to do something like this from my components
This makes it so that using react-native Context-Provider API I can call every store action in ALL my compoennts using globalStore as a link:
In any component I can do:
However I'm still not sure how I can access other store actions from within OTHER STORES.
What if inside postStore I want to use spinnerStore (to show axios calls pending, error or success status):
Here spinnerStore would be undefined...
Beta Was this translation helpful? Give feedback.
All reactions