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.
What is the purpose of using React ?
Is there any advantage which is better than Blaze ?
Is the rendering faster than Blaze ?
Is it possible to make server-side rendering by using React ?
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.
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.
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?
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.
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.
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.
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!!