Reactive Programming with Mobx


#1

I recently interviewed the creator of Mobx and talked to him about what it is, why to use it, and what inspired it (hint: Meteor’s tracker lib). Give it a watch: https://www.youtube.com/watch?v=QTptEw2cYt0


#2

I’ve been trying to use it in a pattern, and I have not been terribly successful. That being said, MobX is phenomenal in combination with React and Meteor.


#3

We created a package to integrate Tracker-enabled data sources with MobX https://github.com/meteor-space/tracker-mobx-autorun


#4

Oh, thanks for watching and thanks for sharing that package!


#5

need more example, how tracker-mobx-autorun work with react !!!

awesome


#6

Yes, I think a lack of information about mobx + meteor is the mobx major weakness.

I started using it a month ago with a meteor on a small project. Actually, it was not so easy to connect the mobx with a tracker. You can google just a few github issues with discussions how to integrate it with meteor and all the solutions not so obvious.

But thanks to a tracker-mobx-autorun and @darkomijic for some help and the magic happened. Mobx took all the ‘shouldComponentUpdate’ work themselves. And now, when the whole project built fully on mobx, I figure out that the magic is gone. Somehow every action which interacts with meteor data starts whole rerendering everything it can.

And the problem that you can’t just google for a similar problem because there is no information. Neither you can find some big open source project with mobx-meteor and have a look how people handle data.

And now, for me seems most simple solution is to forget about meteor tracker and switch right away to the apollo.


#7

Are things really that bad?
I thought of switching to Mobx, it would be disappointing if it couldn’t work with meteor data properly…


#8

you don’t have to use the tracker method. I just use mobs for stores and component specific coolness. works perfectly. Just use it instead of this.setState…


#9

Michele just posted an interesting article about React Context and how Mobx can help avoid issues there: https://medium.com/@mweststrate/how-to-safely-use-react-context-b7e343eff076#.txzcuf4j7