AI summary by TwinMind
Why Everyone Hates Web Components
Theo - t3․gg
1h 22m 39s
Ryan Carniato's Web Components Critique
- Ryan (Solid JS creator) published "Web Components Are Not the Future" article
- Article written after days of Discord arguments with web component advocates
- Claims web components pose "biggest risk to future of web"
- Written in unusually aggressive tone for Ryan (described as "pissed Ryan")
Historical Context: Chrome vs Framework Tension
- Nicole Sullivan (formerly Chrome team) revealed adversarial relationship between Chrome and framework authors
- Chrome team originally didn't understand frameworks, thought real developers used vanilla JS
- Research showed vanilla JS users were mostly hobbyists/students working alone
- Web components created during peak anti-framework era as reaction to React
- Nicole's work helped bridge gap, led to collaboration (e.g., React team teaching Chrome about hydration)
Technical Problems with Web Components
DOM Interface Issues
- Elements are subset of components, not equivalent
- All interfaces must go through DOM with string-only attributes
- Properties vs attributes confusion with custom elements
- Native elements have inconsistent boolean handling (disabled vs aria-disabled)
- Frameworks need special prefixes (attr:, prop:, bool:) to handle web components
Performance and Compatibility
- Custom elements have different cloning behavior
- Must use document.importNode instead of fragment.cloneNode (30% slower)
- Frameworks add extra code/flags to handle web component edge cases
- Shadow DOM breaks event delegation needed for hydration
- Events don't bubble consistently across shadow boundaries
- Focus targeting broken in shadow DOM (always targets host element)
Server-Side Rendering Challenges
- Web components are DOM interface with no server DOM
- SSR requires specific solutions, becomes "just another framework"
- Hydration issues due to shadow DOM event isolation
- Can't replay events that occurred before JS loaded
Framework Author Tax
- Every framework author tried and gave up on web components (React, Vue, Svelte, Solid, Angular, Ember)
- Constant bug fixes, workarounds, extra code, documentation, tests
- Rich Harris: "If I could bill for time spent working around web components, I'd be rich"
- Makes framework code larger, slower, more complex
- Hidden tax affecting all users, not just web component users
Standards vs Framework Flexibility
- Web standards can't be changed once established (backward compatibility)
- JSX example: vague spec led to React assumptions in tooling
- If JSX was browser standard, couldn't optimize transforms
- Web components assume too much, limit future innovation
- Frameworks can evolve and improve; standards are frozen
Interoperability Myth
- Web components don't "just work" with frameworks
- Massive effort required from framework authors to make them work
- Not true interoperability when frameworks must do crazy workarounds
- Bundle size increases with multiple web components vs single framework
- Can't compose web components effectively
Limited Use Cases
- Only good example: isolated widgets like Intercom chat
- Microfront-end pattern works for contained, swappable pieces
- Poor for complex, interactive applications
- Can't mount inside each other or process elements before JS loads
Response from Lea Verou
Web Components vs Framework Components Distinction
- Argues two categories: generalizable elements vs project-specific components
- Generalizable: extend HTML, work across frameworks (tabs, ratings, charts)
- Project-specific: reactive templating for specific use cases
- Claims fragmentation creates duplicated work across frameworks
Authoring vs Consuming Divide
- Consuming web components "pretty smooth" (disputed by framework authors)
- Authoring still "painful, tedious, with foot guns"
- 80% of web component users also author them (from Twitter poll)
- Should empower non-expert developers, not just expert authors
Future Improvements Promised
- Open styleable shadow roots proposal
- Declarative elements and DOM parts
- Eventually may become viable for reactive templating
- But frameworks will always be step ahead of platform
Industry Trends Counter to Web Components
- Movement from component libraries (Material UI) to owned code (Shadcn)
- Shadcn clones components into codebase for full customization
- Industry trending toward ownership model, not shared components
- AI/tooling making code generation easier than reusable components
Technical Examples Highlighted
- JSON viewer component: complex React component that would be miserable as web component
- Form submission: web components require manual form association vs simple type="submit"
- Button example: 3 lines in React vs complex web component implementation
- Model viewer: Google's example still uses Lit framework
Framework Author Consensus
- Rich Harris, Ryan Carniato, Evan You all against web components
- Not conflict of interest - they'd rewrite on web components if beneficial
- Collective "no, it's a tax we should get over"
- Framework authors closest to the problems, most qualified to judge
Performance and Bundle Considerations
- Web components add overhead even when not used
- Framework optimizations (like compiling away components) impossible
- Multiple web components = multiple separate bundles vs shared framework runtime
- "Components are pure overhead" - ideally compiled away entirely
