4 ms·
This example shows how cumbersome the DOM APIs and their limitations are. Also, React is not _just_ DOM diff-ing. It also provides a host of other benefits... s
by dmitriid 10y ago
This example shows how cumbersome the DOM APIs and their limitations are. Also, React is not _just_ DOM diff-ing. It also provides a host of other benefits... some of which are both shown here and covered immediately in the next set of examples with Polymer's kinda-templating-language.
You cannot buy into Web Components without buying into at least Polymer to supply you with data binding.
If you don't like React's size, there are slimmer options: Inferno, Preact etc.
- BinaryIdiot 10y ago> You cannot buy into Web Components without buying into at least Polymer to supply you with data binding. Why? You can use Polymer and not its data binding. In fact you can use its polyfills and deal with mostly the standard based APIs. X-Tags and many others also use Polymer's polyfills. DOM APIs are awkward as hell. But you can create Web Components and handle the data binding yourself. It's actually pretty easy to roll your own data binding. Now whether you should is another matter.
- Touche 10y agoDepending on your use-case you can use a variety of options for data-binding including 1) No data-binding at all (small components), or 2) An HTML-inspired data-binding solution like what Polymer provides or 3) A virtual-dom library like Preact or gasp even React
- e111077 10y agoYou don't have to use the DOM API for everything as in your example. JSX is very much virtualized template tags which are HTML standard. > This gets progressively worse as your components grow in complexity. Imagine adding a span around the text in p? In this case you simply type in the span inside the template tag similar to what you have in the React JSX and then just importNode the contents into your webcomponent.
- dmitriid 10y ago> JSX is very much virtualized template tags which are HTML standard Nope, it's not. It's a thin XML-like DSL which translated into Javascript calls: http://bit.ly/2nC6fdu http://bit.ly/2nC6fdu
- spankalee 10y ago> You cannot buy into Web Components without buying into at least Polymer to supply you with data binding. This is completely and utterly false. What are you basing your assertion on?