You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, so I was going through your code and stumbled upon this comment in store-utils.js w/r/t to linkStores fn().
// This function takes care of helping stores communicate with
// each other. If there is an array defined on any store named
// "linkedStores", the array elements (containing exact names of other stores)
// are used here to "inject" the actual store objects into that store
// so it can be access directly
Not being having a programming background whatsoever, this is exactly the thing I've been struggling with when working with mobx: how to access actions in two or more stores in the same code block. My question:
Is linking in this way performant?
I've never truly seen anything like this. It makes sense somewhat if the stores are quite small, which is in fact how I have mine structured. But it doesnt seem quite right at the same time. Again, i apologize if this is common knowledge is programming, but I had to ask this question.
cheers,
ap
The text was updated successfully, but these errors were encountered:
Hi, sorry for the late reply, I completely missed the notification on this.
Logically, I feel like there shouldn't be any affect on performance compared to any other solution that might connect stores together (if you know of one, please let me know), since the stores are still singletons- we're just referencing them and calling functions on them as we might in any other part of the code.
The only thing we have to be careful of is causing a loop between two stores calling the same functions on each other. But for my use case I mostly use it in a one way direction, that being mostly towards a UIStore to open up loading modals and other interface interactions.
To me as well, it doesn't seem quite right. But it works, and that's what counts I guess 😅 I'm always open to finding better ways to do it though!
Hey, so I was going through your code and stumbled upon this comment in store-utils.js w/r/t to linkStores fn().
Not being having a programming background whatsoever, this is exactly the thing I've been struggling with when working with mobx: how to access actions in two or more stores in the same code block. My question:
Is linking in this way performant?
I've never truly seen anything like this. It makes sense somewhat if the stores are quite small, which is in fact how I have mine structured. But it doesnt seem quite right at the same time. Again, i apologize if this is common knowledge is programming, but I had to ask this question.
cheers,
ap
The text was updated successfully, but these errors were encountered: