Some things after I've been working with it for a few months
1) One of the great thing of React to me is the fact that we're writing everything in Javascript. With a very small syntax enhancer that is JSX you can write XML inside of the Javascript.
The end result is that you don't need to learn a template language or many new concepts such as all the ng-repeat, or code inside of strings that angular has.
If the framework doesn't support something, you can just implement it yourself. The React dom nodes are just regular javascript objects and you use regular arrays to manipulate them.
It is also very convenient to be able to write XML in Javascript. You work with html trees all the time yet you can't easily make new ones in js.
2) Having a representation of the DOM in javascript is a huge enabler.
Out of the box we can batch all the expensive DOM operations and only update the parts that actually changed.
But it allows to do more crazy things. We can put all our application logic in a web worker or render the page server side. There are a lot of cool possibilities once you are in a React world.
3) One of the huge issue we face as js developer is traversing the dom to get a reference to whatever node we want. jQuery shine with that. React transforms the paradigm. Instead of finding dom nodes you are creating them.
It leads to different ways of seeing the world. If you want to hide an element, instead of finding it and hiding it, you just don't create it in the first place.
This is great. To be frank, if I knew this was in the pipeline, I wouldn't have spent the past few months learning AngularJS. AngularJS, but it's fairly unintuitive to learn, and working with 3rd party libraries can be a pain with AngularJS. Most importantly, I already had a good grasp of Backbone. I love how Backbone organizes apps, and I love consuming REST APIs with Backbone. But handling the DOM is a pain in Backbone, and can result in performance issues if you're not careful.
This project appears to solve this issue and to integrate well with Backbone. I'm really looking forward to learning more about React.js.
Curious about this one (coming from mobile web perspective crappy cpu, high latency).
Render the page with node / serve html / React calls its render functions? / something else ? How does it bind to the already existing dom without building it? do all the render()s have to be called twice (once on server, once on client)?
Hey, I built this feature and was super stoked about it :)
First of all, we haven't released the official server rendering stuff yet, since the API still needs to be cleaned up. But it's a total of 20 lines or so, so I'll likely post an example soon :)
So React has a very low degree of coupling to the browser. Specifically it has two phases:
1. Generate the HTML markup, giving each DOM node a unique ID
2. Attach top-level event handlers. When an event fires we look at the target ID to figure out which component to bubble to (we have normalized, cross-browser bubbling and capturing built into our synthetic event system).
In client-rendered apps we run both of these on the client. For server rendered apps, we initialize and only generate markup on the server and send it down. Then on the client we re-initialize, but notice that the markup is there so we just attach event handlers.
This system enabled us to build a prototype a while back that ran React entirely in a web worker, but we haven't had time to productionize that yet.
1) One of the great thing of React to me is the fact that we're writing everything in Javascript. With a very small syntax enhancer that is JSX you can write XML inside of the Javascript.
The end result is that you don't need to learn a template language or many new concepts such as all the ng-repeat, or code inside of strings that angular has.
If the framework doesn't support something, you can just implement it yourself. The React dom nodes are just regular javascript objects and you use regular arrays to manipulate them.
It is also very convenient to be able to write XML in Javascript. You work with html trees all the time yet you can't easily make new ones in js.
2) Having a representation of the DOM in javascript is a huge enabler.
Out of the box we can batch all the expensive DOM operations and only update the parts that actually changed.
But it allows to do more crazy things. We can put all our application logic in a web worker or render the page server side. There are a lot of cool possibilities once you are in a React world.
3) One of the huge issue we face as js developer is traversing the dom to get a reference to whatever node we want. jQuery shine with that. React transforms the paradigm. Instead of finding dom nodes you are creating them.
It leads to different ways of seeing the world. If you want to hide an element, instead of finding it and hiding it, you just don't create it in the first place.