I’ve seen a lot of different efforts out there to integrate React with Meteor and I’m seeing a lot of repetition.
(new users can only post 2 links per post, so I’ll put the rest in the comments)
I think we all ought coordinate a little better so we’re not constantly reinventing the wheel. As you can see, I’ve been working on a react package so here are some thoughts I’ve had to get the discussion going.
-
I think there needs to be an official un-opinionated React package that simply includes the latest version of React on the server and the client. No Meteor mixins in this package so people are free to create their own. Since these seems to be a variety of opinions on compiling JSX (babel, harmony CJSX), it seems better to keep these packages separate as well.
-
As for a the meteor mixin goes, there are a few features that I’ve found quite useful:
2a)getMeteorState
is much likeTemplate.helpers
and provides fine-grained reactivity:
getMeteorState: {
posts: function() { ... }
users: function() { ... }
}
2b) getMeteorSub
allows you to create subscriptions. These could also be fine-grained reactive functions:
getMeteorSubs: {
post: function() { ... }
user: function() { ... }
}
2c) to leverage the fine-grained reactivity, we can transfer all props to reactive variables in this.rprops
so we can do things like:
getMeteorSubs: {
post: function() { return Posts.findOne(this.rprops.postId.get()) }
}
Let me know what you think about these points. I’m open to ideas. I just think that the whole community would be better off if we worked together rather than all building our own React-Meteor packages.
Cheers,
Chet