Is React better than Blaze?


#1

Currently, I’m studying Blaze and Spacebars, and really surprised that the features of them, such as Custom Block Helpers(good to make a minmal feature as a set of components) and Dynamic Template Includes(good to structure templates), are really good.

So, I have four questions about React in terms of Blaze.

  1. What is the purpose of using React ?

  2. Is there any advantage which is better than Blaze ?

  3. Is the rendering faster than Blaze ?

  4. Is it possible to make server-side rendering by using React ?


#2

google/forum search is your friend :wink:


#3

OK, I’ve drunk the kool-aid. I think React is the way forward. This article single handedly changes my mind. It makes so much sense to isolate your components like that.

http://reactfordesigners.com/labs/reactjs-introduction-for-people-who-know-just-enough-jquery-to-get-by/


#4

@sashko Re: twitter convo, this and

are egs of people asking the question. I think the beginning of render section of the Meteor docs should list pros/cons of all three officially-supported render engines, to help people make the decision of which to choose. I think it should include things like:

  • react HTML and CSS is different
  • brief example of how a single template, helper, and event handler looks different in each
  • link to codebases of eg leaderboard implemented all 3 ways
  • react and angular have more published components than blaze
  • angular has many more developers / SO questions / GH repos /etc than react/blaze
  • react has react native
  • react may be generally fastest?
  • react may have highest heap usage?
  • blaze can do granular cursor #each changes
  • react has SSR
  • from @slava: “I would add that React doesn’t work that well with DOM manipulations from outside, if you have a 3rd party widget, a Facebook Liked widget, or just a jquery plugin that creates a gallery - Blaze would most likely just let the 3rd party manipulations happen and React will restrict you from doing this.”

I don’t think it takes all that complex an app for you to be able to notice render performance differences between them on mobile. And even if there aren’t many apps that perf will matter for, there are more people who factor it into their decision than will need it. So while I would include a statement like, “It takes a moderately complex mobile app and very complex desktop app for this to make a noticeable difference”, I do think it would be good to include perf notes in the pro/con list.

cc @Urigo @avital


#5

Regarding your point of having three codebases you can compare, when 1.2 comes out we will have identical tutorials with React, Angular, and Blaze. Here’s my rough draft for the React one: http://react-tutorial.meteor.com/

We will create a UI where you can easily switch view layers in each step, hopefully that will make it easier to see the differences and similarities.

(The source for that tutorial is currently here: https://github.com/meteor/tutorials/tree/master/steps/react)


#6

@davidrums @sergiotapia @loren @sashko Thank you guys! Now I solved my curiosity.

@sashko
I have some questions about 1.2.

  1. When is planning to release it ?

  2. Will data context be deprecated in Blaze2 as mentioned in Proposal for Blaze2?

Currently, I’m mostly using patterns of Template.dynamic() to use data contexts intuitionally for each template’s helpers, and to structure templates as hierachy, so I’m curious of what patterns I can use alternatively, if it is deprecated.


#7

The react tutorial is so good! Even in it’s current beta-state. Instantly let me know what React was all about and had it working locally easily.

The problem I had though was putting React into practice. There is no clear way of using React with different url routes. At least I couldn’t find one concrete example that used latest packages. Only a couple of tutorials from 2014.

One simple, but very useful scenario I wanted to test out was show one layout when a user is logged out, and show another layout when a user is logged in. Do you have any examples?


#8

react isn’t always better. It has more issue than blaze, especially since blaze is built upon very old and stable technologies (e.g: mustache) while react is the new kid.

It is more powerful and faster if you have data intensive apps, at the cost of complexity. Sometimes complexity f***s everything up, especially speed. So you have to weight the options.


#9

Thank you @muaddib :slight_smile: I think it is little bit early to use it right now , so I should keep an eye on React until 1.2 released.


#10

I would say that in fact react is some intermediary step on the way to something that is webcomponents.

Personally I looked at react and find it good in the sense that it is an evolution in terms of having reusable components. In the end however I do think that one could (should?) go for webcompoenents (e.g. Polymer) right away because that’s the next evolutionary step after something like react anyway.


Add first-class support for WebComponents (e.g. Blaze 2)
#11

I agree with your opinion that the significant thing is web components + Meteor. If this is solved, I think that React might not be needed in terms of the feature.
However, MDG is preparing for React which is already having the feature of components that fits well with other features(eg, pub/sub, Meteor.methods/Meteor.call, MiniMongo/Collections, etc) of Meteor, because (I think that) the better component feature is not yet ready.
Also, I think that the current way is correct for the concept of Meteor planning to be as a platform, and it will make Meteor as a game changer.
And on that time, I think that we can have a choice for stack, such as Meteor+React+React Native, Meteor+Blaze+web component+Cordova(?) or Meteor+Angular2.0+NativeScript, based on the required concept of our application including webapp and mobile apps.


#12

I agree. web components and Polymer are just not ready yet. Real production apps can’t just wait for the perfect technology to arrive. I would imagine that React 2.0 will use web components under the hood once they’re settled and the better way to go.


#13

I think Blaze just makes way more sense to develop with. I hope to see it pushed further in the future, and hopefully not abandoned for React


#14

I´m not an expert but React is another mainstream mania.
Vuejs is a lot simpler and gets the job done as well.
So why all the angular headaches and newbie react on the scene ?
I like to keep it simple.
Vuejs should be welcomed also in this party!!


#15

I’ve been mixing React and Blaze in my side project and I’ve found that Blaze is much easier and React is much faster.