Hacker News new | ask | show | jobs
by afavour 1049 days ago
Web Components are just an API, a means to an end. You might as easily say nobody cares for document.createElement() but it’s still used by underlying code all the time.

If it were much easier to mix and match components that use different frameworks then people would be using web components whether they know it or not. But we’re in a React monoculture and React folks seem quite content with that.

2 comments

mm...

Web components aren't 'an' api, it's a specific way of using a set of apis, and specifically requires you to use a set of templates in a way that frameworks (which looovvvveeee DSLs) won't accept.

The other bits? shadow dom? Custom elements? eh. Those are things a framework will wrap happily enough if they see value in it. Maybe some already do? As you say, you'd never know...

...but those html templates will never fly. They're just crazy bad ergonomics and framework authors will never accept them.

That's really the core of the issue; invoking components in your layout requires you to use some kind of layout template, and every framework does it differently.

That's why cross framework css solutions (eg. tailwind) are massively successful, because they can be called easily by anyone regardless of the templating; the same is not... and, frankly, seems like it never will, be true of web components.

They shouldn't be called web components in React (typical JS world term squatting). Instead they should be called React Components.