5 ms·
I wish the author had tried Polymer because it's the most underrated one. I just love the way Polymer components declare/consume dependencies (as tags in the co
by jondubois 10y ago
I wish the author had tried Polymer because it's the most underrated one.
I just love the way Polymer components declare/consume dependencies (as tags in the component file)
and connect all sub-components in the template markup via attributes - It makes data binding relationships between components and their children very clear.
Polymer is basically an inverted version of React (and it achieves a similar outcome).
In React, template markup is nested inside the code.
In Polymer, code is nested inside the template markup.
I really like React but I wouldn't use it for a personal project knowing that Polymer exists.
I hope Polymer will gain more traction because I would love to be able to use it professionally.
- pluma 10y agoIn React there are no templates, just component trees.
- renesd 10y agoEverything in react is done in the template language. This react below is not JavaScript... it's a reverse template language with a mix of not-quite-html and not-quite-JavaScript. jQuery style code is nicer than that! I hate the enterprise boilerplate in react projects. No wonder they're all failing! class Square extends React.Component { constructor() { super(); this.state = { value: null, }; } render() { return ( <button className="square" onClick={() => this.setState({value: 'X'})}> {this.state.value} </button> ); } } It's like facebook is a php shop or something... Oh wait. Not for me thanks.
- bromuro 10y agoJSX is not a template language, it is just syntax sugar: see it as a different way to write javascript: https://facebook.github.io/react/docs/jsx-in-depth.html https://facebook.github.io/react/docs/jsx-in-depth.html you can't say the same about templates.
- renesd 10y agoIt's not JavaScript, and it mixes in almost-html... but it's not a template language? Wrong. It's a template language, even if Facebook tells you otherwise.
- zodiac 10y agoIt really isn't a template language as the term is commonly used. If you feel so strongly about the weird syntax you can write equivalent code in javascript syntax instead. return React.createElement( button, { className: "square", onClick: () => this.setState({value: 'X'}) }, this.state.value ); If you think your code is written in a template language, then the code I just wrote must also be written in a template language (with different syntax).
- renesd 10y agoThat looks like JavaScript. Yes, of course you can use that - but which react projects do it that way? It seems this is mostly pulled out when people go... ewwwwwwww, stinky... Most use the html+javascript language which is compiled and then spits out JavaScript and html. This is pretty much identical to PHP - which is a preprocessor template language. Anyway, facebook says it reminds me of a template language, so I'll believe them.
- zodiac 10y ago> Most use the html+javascript language which is compiled and then spits out JavaScript and html. This is pretty much identical to PHP - which is a preprocessor template language. No, it spits out javascript (the exact same javascript that I wrote), which returns shadow DOM trees (which are javascript objects), which the renderer looks at to modify the actual DOM. Also not sure what you mean by "looks like" javascript. It's clearly javascript - just a function call with 4 arguments.
- milesrout 10y agoThat's not a good thing. I want to write this, and have it actually be HTML: <div> <div> </div> <div> I like HTML.
- deleted 10y ago[deleted]
- johnfn 10y agoIf you don't like the "boilerplate" of a single class definition, use a functional component, which is just a function that returns JSX, that is also a component. It could literally not be more straightforward. Or could you not hear me over the sound of that axe you're grinding? :)
- mtzaldo 10y ago*stateless components
- deleted 10y ago[deleted]
- ergo14 10y agoPolymer traction is looking good, over 7k people on slack channel, 750 elements on webcomponents.org. And they got first day on google IO this year, youtube main site is being rewritten in it, ING, IBM, GE are using it, so it gets quite a bit of love from enterprise too.
- Pigo 10y agoI remember looking at Polymer before I discovered Angular Material, and I really wanted to give it a go. I guess I played it safe by sticking with the thing I already knew, and I liked the Material docs. But I'd still like to try Polymer. My biggest hangup with trying new platforms is finding a good UI framework to go with it, I like handing off styling to people who know what their doing.
- jondubois 10y agoI feel more comfortable using technologies that have had moderate, steady growth in popularity over many years like Polymer than technologies which experienced sudden, explosive growth like Angular 1 (we know how that turned out). Early explosive growth means that the technology is hype-driven; adopters haven't given themselves the time to critically and objectively evaluate the solution - It's not so different from economic bubbles. People get excited and buy into it without thinking and then at some point in the future when they realise that it won't live up to their expectations they all start selling at the same time.
- H1Supreme 10y agoI've used both Polymer and Vue for a few projects, and Vue's single file component method, coupled with WebPack, is almost identical to writing an app with Polymer. Except that Vue doesn't ship with all the Polyfill baggage that Polymer does. Polymer has came a long way, but it still feels slow on anything but Chrome. Once the Web Component spec is finalized, and built into browsers, I think Polymer will be a great choice. Today though, I gotta give the nod to Vue.