|
|
|
|
|
by no_wizard
1049 days ago
|
|
This is a half truth. Their are big problems with this approach, as I think a lot of folks are finding out the hard way, namely: - You cede rendering control from your framework to the web component, if it does anything like conditional children etc. meaning it can be hard to optimize or you get stuck using refs, which is suboptimal and in some frameworks makes optimizations hard to achieve - it’s de facto CSS in JS and to boot your styles are also locked to shadow dom. Yes I know this isn’t true in an absolute sense but in practice all the web component implementations leverage this. This makes styling harder, can have performance impacts etc. also means you can’t leverage CDN caching and distribution for your styles - FOUC is a real problem with web components as it exists today. - Interop varies and can have gotchas, especially with custom events that may be emitted by components - You can’t get fine grained optimizations in some frameworks using them because web components in practice often contain some kind of logic one way or another. - to use slot you must use shadow dom, and that means your app needs to be rendering against a shadow root of some sort, which can be real clunky |
|