Skip to content

How to get data of different model in MST? #2503

Answered by frankcalise
mrshahzeb7 asked this question in Q&A
Discussion options

You must be logged in to vote

hey @mrshahzeb7 , you can do this by using the getRootStore helper here: https://github.com/infinitered/ignite/blob/master/boilerplate/app/models/RootStore.ts

So, for example if your root store looked something like this:

export const RootStoreModel = types.model("RootStore").props({
  propertyListStore: types.optional(PropertyListModel, {}),
  propertyDetailsStore: types.optional(PropertyDetailsModel, {}),
})

You could then call on a property from the list store in detail store with:

getRootStore(_self).propertyListStore.myProp

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mrshahzeb7
Comment options

Answer selected by mrshahzeb7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants