Automatic observer
wrapping
#1984
-
Generally, many people use MST with React through Context API and root store concept like this. const ExampleComponent = () => {
const rootStore = useStore(); // Which return root store containing all other stores
// ...
}
export default observer(ExampleComponent); However, there are weak points. We have to write two lines of code when using MST. 1) USE hook to get root store In this context, there are lots of situation when I forget second case. So, its hard to debug why component doesn't get fresh data of some stores. Is there a way to skip second case that wrapping component with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @baeharam! There was some nice discussion on this topic a while back here. The creator of Legend-State finished with the following:
|
Beta Was this translation helpful? Give feedback.
Hi @baeharam!
There was some nice discussion on this topic a while back here.
The creator of Legend-State finished with the following: