Is React better than Blaze?

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 ?

1 Like

https://crater.io/posts/sJwY6BSMBhREpnrz6

google/forum search is your friend :wink:

1 Like

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/

1 Like

@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

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)

8 Likes

@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.

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?

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.

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.

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.

2 Likes

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.

1 Like

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.

1 Like

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

7 Likes

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!!

3 Likes

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.

1 Like