Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They're not different from built-in elements and don't need special treatment.

The way that frameworks that work well with web components do it is be not giving special treatment to things. Vue, Angular, and lit-html all treat built-ins and custom elements then same, and they have different syntax for setting attributes and properties.

React treats elements different from components and sets properties on React components and attributes on HTML elements, with no syntax to set properties on elements. Then it special cases a list of attributes so that things like `class` map to `classList`.

So... remove special cases, add general abilities, and it all just works.



They're different from built-in elements at least in the fact that they're not built-in - that is the problem with React, which works with a list of built-in components that are treated differently from React components. Which means React needs special treatment for Web Components.

Whether React should or should not be doing that is irrelevant; what's relevant is that as a developer, you need to be aware that you can't "just" use Web Components in any framework.


That seems a rather silly distinction to me: "They're a special case because they're not on React's list of special cases".

You've correctly pointed out that the special cases are the problem, but are putting the blame on the things that are not special cases instead of the thing doing the special casing.

This is fundamentally React's problem. It's the only major framework to even have issues here.


Again: I don't care who's to "blame". I care about whether I can just use Web Components in any web framework, which is not the case.


The do work in React. It's hard for them not to, since they're just elements.

React just had a more complicated way of setting properties. Entirely due to React's choices.


Sure, but if your standard is "it can work in React, just with some more work and downsides", then technically you can use Angular components in React as well.

tl;dr you'll still be doing the wrapping in practice.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: