React and MST
Can I use React and MST together?
Yep, that works perfectly fine, everything that applies to MobX and React applies to MST and React as well. observer
, autorun
, etc. will work as expected.
To share MST trees between components we recommend to use React.createContext
.
In the examples folder several examples of React and MST can be found, or check this example which uses hooks (recommended).
Tips
When passing models in to a component do not use the spread syntax, e.g. <Component foo={bar} {...model}>
. See here.