Skip to content

How to run store action from outside a component? #2110

Answered by KyryloSWAN
KyryloSWAN asked this question in Q&A
Discussion options

You must be logged in to vote

I got access to the mst store outside React components by replace

<storeContext.Provider value={useLocalObservable(createStore)}>{children}</storeContext.Provider>

to

<storeContext.Provider value={observable(createStore())}>{children}</storeContext.Provider>

in StoreProvider component.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by KyryloSWAN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant