6 ms·
What will this actually be useful for?
by Retr0spectrum 10y ago
What will this actually be useful for?
- Touche 10y agoThere are examples in this very article.
- achairapart 10y agoA dependency-less, component-based alternative to React. It's part of Web Components: http://webcomponents.org http://webcomponents.org
- untog 10y agoParts of React. For me the state management is a core part of React, and as far as I can tell this doesn't cover that, just the rendering part.
- some1else 10y agoWhat part of React "state management" do you find indispensable?
- some1else 10y agoI don't see the reason for down-votes here guys. It's a legitimate question, isn't it? I was hoping the recipient would understand - once they try to enumerate "the parts" - that it's them managing the state, and that centralized state management and unidirectional data flow are obtainable in Backbone, Custom Elements, or vanilla JavaScript for that matter.
- grzm 10y agoJust speculating, but they have picked up on the Socratic method aspect. Some find that condescending. If that's actually your goal (as indicated by "I was hoping the recipient would understand"), it's not so much a legitimate question that you want to know the answer to, is it? With your explanation, it's more of a rhetorical device. Personally, I didn't read it that way (nor did I down vote you), but given your follow-up, I can see how some might.
- jannotti 10y agoThis seems almost exactly like all of React. These components do have state, just like a React component. If you're talking about how the state is changed, then now you're not talking about React. You're talking about redux, flex, etc. You may very well want something like that here too, but that's not because this isn't like React, it's because it is like React.
- aljones 10y agohttps://github.com/facebook/react/issues/5052#issuecomment-145594782 https://github.com/facebook/react/issues/5052#issuecomment-1...
- tolmasky 10y agoA big part of React (and arguably the whole point of React), is the way in which state changes are handled and re-rendered. A React version of this progress bar element would simply have a render method, that when the state changed would simply be called again for another full-re-render of the element. The fact that this grabs individual elements and mutates them is about as far from React-style programming as you can get. Virtual DOM, tree-diffing, all of this is around a central concept that "immediate mode" programming reduces visual bugs, and is completely absent from custom elements. I'm not saying Custom Element are wrong, but they are absolutely different from React in a core and essential way.
- mambodog 10y agoWhere's the part of React which allows me to return a new copy of what I want the HTML to look like, while only updating the changed elements of my view instead of totally blowing away the existing elements (the virtual DOM + reconcilitation part of React)? Also, where's the declarative event binding part? I'd also point out that the state tree (setState) is a part of React, and plenty of apps are just fine being built using only setState for state management (no redux/flux/mobx).
- Touche 10y agoYou're right, custom elements don't do that, and it's not a goal of the custom elements spec (as far as I can tell) to promote any particular programming style. It's a low level spec. So showing the most low-level way to use it makes sense. Here's a library that combines custom elements with VDOM rendering: https://github.com/skatejs/skatejs https://github.com/skatejs/skatejs
- rpwverheij 10y agoAh yes that's what I was wondering. So Custom Elements are actually part of the Web Components standard, and it looks like it was already implemented in Chrome and Opera, works with a flag under Firefox and so now it has landed in Webkit / Safari, right? Besides Edge, and safari's support for HTML imports, it looks like Web Components implementation is slowly getting there. What about uses? Are there any popular webcomponents out there yet?
- thewhitetulip 10y agoI just watched the talks of Google IO and Polymer Summit, Polymer has a lot of big name users (Coca Cola, net-a-porte have no clue what this is, EA etc)