4 ms·
I really like webcomponents, but they still statefully update the UIX, just like most native ui frameworks. React solves this by giving a declarative functiona
by TeeWEE 11y ago
I really like webcomponents, but they still statefully update the UIX, just like most native ui frameworks.
React solves this by giving a declarative functional approach to webdevelopment.
Would it be possible to combine both react with webcomponents?
If so, are there any demo"s out there? I couldnt find anything.
- Zikes 11y agoSO has some discussion on React & Web Components: http://programmers.stackexchange.com/questions/225400/pros-and-cons-of-facebooks-react-vs-web-components-polymer http://programmers.stackexchange.com/questions/225400/pros-a...
- mbrock 11y agoThat depends on what you are doing inside of your web components. You can load any JavaScript you want in there, you know. If you want to use React, that's fine. Web Components is just a set of extensions to the DOM standards to allow encapsulated custom elements.
- bsimpson 11y agoI was wondering about that when I read this post this morning. The interface of a React component is very small: it's effectively just a render function with some lifecycle hooks and an internal setState method. Depending on your data management philosophy, you can even scrap state altogether and leave just the render function: var View = (props) => <div>{ props.content } </div>; You could probably write a Polymer-esque library that let you create Web Components with a similar API. I haven't looked into the implementation details of react-{dom, canvas, -native}, but I imagine that's effectively what they do - bridge from that API to the platform's native one. I expect that if Web Components are ever faster or otherwise better than the legacy DOM, such a shim will emerge to make WC as easy to write as React components.