DEV Community

Discussion on: Why the React community is missing the point about Web Components

Collapse
 
erobwen profile image
Robert Wensman

It seems to me that the WC community is also completely missing the point with React. For those who build static non-responsive web pages based on interactive components, there is probably no reason to use React at all. You could just as well use WC. However, for those who wish to build the dynamic pages of the future, there is certainly a need for the likes of React.

So what is React? It seems to me that this article completely misses the point on that. React is not just a way to define static components on a website. React is foremost a way to constantly and dynamically rebuild those components, without loosing the state of some components mind you!

So, react and the synthetic DOM comes to use when:

  1. The UI is rebuilt when the screen size changes.
  2. The UI is rebuilt when the data model changes.

And this is the whole point with the synthetic DOM, whether you like the (slight?) performance penalty or not.

The whole point with React, is that you can write your code, without concern for how all the components will be updated/relocated and moved once the dynamic user interface updates.

And as far as I can see, WC has no solution for this whatsoever. WC is just a way to isolate and package components, but WC in itself offer no coherent and thought out methodology to rebuild and rearrange those components.

So, if there is a resistance from the React community, in adopting WC... think again. Perhaps there is a valid reason for it.

And, it is also my guess that many of those who fail to se value in React over WC, probably never built very dynamic user interfaces.

Collapse
 
frrwhat profile image
Mark Schmeets • Edited

I remember the old saw about "alternating hard and soft layers". React and WC are exactly that. WC provide the "hard layer" basically an extension of HTML as a platform. React is the soft layer we use to assemble the WC into our working applications. Think C components, plus Python. Or C++ COM and Visual Basic.

The only problem is that React and WC do not interface very cleanly for events, or properties. Once that is fixed it's going to be a great combination. Just wish the React team would put more a higher priority on that.