|
|
|
|
|
by jondubois
3521 days ago
|
|
I heard about SkateJS a long time ago. It looks like it has kept evolving. Reading the docs now, it looks very, very similar to Google's Polymer framework. Polymer is even mentioned here https://github.com/skatejs/skatejs#vs-polymer but the comparison appears to be partially out of date - Like SkateJS, Polymer only updates the elements which changed - Even when rendering lists; it won't re-render the entire list if only one element changed. It seems the main benefits over Polymer are customizable template languages and support for more different package managers... I really like how every component in Polymer is essentially an HTML template with its own sub-DOM. I also like the way Polymer lets you specify dependencies in components as <link rel="import" href="..."> tags. Polymer is like the inverse of React; React components are source files with template markup embedded inside them while Polymer components are template markup files with source code embedded inside them. I find Polymer's approach cleaner and more readable because all the source code is concentrated in one place. I don't know what the equivalent is for SkateJS... |
|
That said, yes, Polymer does only change the parts of the DOM that need updating but there's still a fundamental difference in that Skate re-renders using a virtual DOM whereas Polymer keeps track of the elements that need updating and uses observables. Observables require you specify how they should behave depending on how you expect them to be set. Even so, sometimes you have to manually trigger them to update in order for your component to update. Skate relies on the same principle React does: you update a property, you re-render. The major difference here being that Skate checks references by default in updated() (like shouldComponentUpdate()) thus only re-rendering if necessary.
As jpnelson mentioned, Skate is more React-like than Polymer-like in its API, but it's still not 1:1 due to the specs. Some things like componentWillMount() don't translate because connectedCallback() is fired after the element is connected to the document. They're all different libraries; direct comparisons are hard.
FWIW, I'm not trying to downplay other libraries, either. Polymer is a great library and a major source of inspiration, just like React is.