Mobx Computed values in Ignite File Structure #1824
OfficialDarkComet
started this conversation in
General
Replies: 1 comment
-
First off, sorry I missed this question! I think this is a situation where a MST What I would do is add the view to a parent of the stores/models that you are sourcing the data from. For example: const RootStore = types.model("RootStore", {
userStore: UserStore,
authStore: AuthStore
})
.views(store => ({
get currentUsername() {
return store.userStore.users.find(u => store.authStore.currentUserId === u.id).username
}
}) Hopefully this makes sense! If you meant something different, let me know! |
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
-
I'm trying to figure out the best place to keep my Mobx computed value files within Ignites file structure.
My thought is if values are computed from MST stored values, then I'd store the files with the MST models they coordinate with and then import them where I need them (these values are likely to be used by more than one component).
I'm aware this is based on opinion/preference, but anyone have any suggestions? Is there some guidelines I should try and follow when it comes to Mobx or MST that would make my life easier?
Or would using autorun be easier? If I do this, how can I include these values with the model? So I can call modelName.valueName to get them similar running actions? My goal is to have observable values based on the models that ONLY generate when the model updates.
- Logan (aka DarkComet)
Beta Was this translation helpful? Give feedback.
All reactions