5 ms·
So, IIUC, Polymer and FB React are competing visions of how to build web components. Does anyone have direct experience with both, and can compare them from a
by cpr 11y ago
So, IIUC, Polymer and FB React are competing visions of how to build web components.
Does anyone have direct experience with both, and can compare them from a real-world usage viewpoint?
Thanks!
- spankalee 11y agoReact does not let you build Web Components, it's a monolithic framework in the same vein as Angular, Ember, etc. Real world usage, you can import and drop a Polymer element on your page and it just works. With React, your whole app has to be React.
- jdlshore 11y agoThat's not true at all. React can replace any DOM element, and you can have multiple instances of React running on a page. React describes itself as a UI library rather than a framework. When I reviewed it [1], that seemed fairly accurate. I found it trivial to separate my React UI code from the rest of my application. [1] An Unconventional Review of React: http://www.letscodejavascript.com/v3/blog/2014/09/react_review http://www.letscodejavascript.com/v3/blog/2014/09/react_revi...
- spankalee 11y agoIt's true that React doesn't let you build web components. React does not use or polyfill Custom Elements or Shadow DOM. It's also true that React is "monolithic" in the way that other frameworks are: they don't naturally interoperate, or do by cumbersome adapter libraries that require wrapping widgets and marshaling between data-binding techniques. They interfere with normal DOM usage, and tend to break if other code modifies a component's DOM (granted Shady DOM has made this trade off temporarily), and they aren't "just elements" - getting a node controlled by React out of the DOM doesn't get you the component itself, no useful API is added to the node. You simply don't see many applications that mix and match React, Angular and Ember because of this. This Polymer difference is that it's deigned to help you create "just elements" so that they're interoperable with other frameworks, plain JavaScript or just HTML. Users of Polymer elements should never have to know that they were made with Polymer. Needing to use Shady DOM APIs is an unfortunate exception to this, but an site can choose to use the full Shadow DOM polyfill if the performance fits their needs.