Hacker News new | ask | show | jobs
by hajile 2581 days ago
React can be used with web components if you want.

https://reactjs.org/docs/web-components.html

The big issue is browser support. According to caniuse, IE and Edge simply have zero support while Opera and Safari have only partial compliance. The current Firefox ESR doesn't support it either (behind a flag).

The polyfill incurs a big performance hit and a lot of devs need to support those browsers for several more years.

1 comments

Edge support is perfectly fine, and it is going to be replaced by Chrome anyway.

Firefox, Safari and Chrome based browsers are perfectly fine.

Opera is based on Bink nowadays.

ESR is not something that I regularly see in the wild.

In any case, I was speaking that only see this anti-WebComponents attitude in the React community.

Safari doesn't support customized built-in elements, at all, and isn't going to. That is pretty far from being "perfectly fine".
I see all green here.

https://www.webcomponents.org/

https://caniuse.com/#search=web%20components

The Shadow DOM and Custom Elements are not that kind of green it should be.

That's silly, customized built-ins are not an essential feature. They are a nice to have. You can get by without ever using them, which is indeed what most people do. As does the subject of this discuss, the Lightning Web Components doesn't use that feature at all.
It also means, that you cannot use existing form controls for your custom element, you must build them up from scratch from divs, and relegate them into uncanny valley of not-quite-native, slightly-off elements.

Yes, it is possible to not use them; you can always make your life harder than necessary, you could also write an modern OS in assembly, for example, if you wanted to. If people are avoiding them today, one reason could be that they want their components to run in Safari.