Does React completely eliminate any need for helpers and traditional events in Meteor?


#1

I’m starting to jump on the React train, since it seems that the community is shifting towards that instead of Blaze.

I find Blaze a lot easier, more intuitive. I see nothing new that I can’t do with Blaze. However, as I dive deeper into React, I notice that there shouldn’t be any need for traditional helpers and events (like Template.MyTemplate.helpers() and Template.MyTemplate.events() syntax). It seems like events that would usually be handled via these methods are now handled inside React components and I see how React can make things a little bit easier in that regard)

So to other people who have been using React: Is this a true assumption? How would you grade using React vs. doing it the old way with Blaze?


#2

Yeah the main difference is:

  1. Most helpers are eliminated, because you can write simple code directly in your JSX. <span>{ val1 + val2 }</span>
  2. Event binding via CSS selectors is eliminated, since you bind callbacks directly in your component like <button onClick={func} />

Only thing to keep in mind is that, per the best practices in the React community today, data loading should be done in special “container components” rather than in your JSX directly, like so: http://guide.meteor.com/react.html#data

In fact, the render functions of your React components are not reactive - changes can only be triggered from createContainer so that you can more easily track when your component is re-rendering, and more easily test your components independent of the Meteor data system.