Brian Leroux: ES6 and Web Components
Good overview. Issues:
- YUI is an example of a key problem w/ corp stewardship; Angular, Polymer, React all OK though?
- HTML Imports in trouble as Mozilla doesn’t want to implement; Custom Elements OK even though Chrome is the only implementation?
- Overall, Brian mentions four specifications, and crosses off three. Why not all four?
My take is that this talk lumps React in with others based on when it was introduced; but that it is fundamentally different from, say Angular.js as Angular.js is from jQuery. Compared to the alternatives, react is more imperative, and is based on a virtual DOM. It also can run in both the server and the client.
I have my own page on which I would suggest that you view source:
calendar-demo (Update: that site is down, try this static snapshot). Use the left and right arrow buttons to go to the previous and next months. Viewing source reveals that the page is delivered pre-rendered, and only after the content is delivered are script libraries loaded. Traversing to the next and previous months are pretty snappy despite the fact that there has been no optimization: in particular, there are no anticipatory prefetches. Nor is data retained should you go back to a previous month. Neither of these changes would be hard to implement.
Source is available in svn. Check it out, do a bundle update to get the dependencies, run rake if you want to run a few tests, and run rackup to start a local server.
I must say that being able to define a component with all of the rendering, client, and server logic in one place is very appealing to me.
Brian suggests authoring source in ES6, and targeting ES5. My preference would be to work towards building a language that is to ES6 as CoffeeScript is to ES5. At the moment, my experimentation along those lines is happening in Ruby2JS.
React Native looks worth watching. Perhaps as my calendar is using flexbox, I will be able to quickly build an Android or IOS equivalent.