AI summary by TwinMind
"Zero JS" Is A Bad Idea
Theo - t3․gg
5m 25s
JavaScript as Web Standard
- JavaScript now expectation of web same way HTML/CSS is
- 99.5%+ of web users running JavaScript (not 70% majority)
- All users are zero JS users briefly when page loads, but not for long
- Once JS cached, enables many important functionalities
Zero JS Philosophy Critique
- Astro/Quick community advocates: never ship unnecessary JavaScript
- Applications should work without JS if use case doesn't require it
- Problem exists: websites with simple forms loading 400kb JavaScript for AJAX behaviors
- Author acknowledges concern but considers it uncommon problem
- Few new projects started with complex JS frameworks are "just forms"
JavaScript Necessities for Modern Web
- Required for: client-side routing, analytics, crash reports, bug/behavior reports
- Essential for building good software on web - not optional
- Pursuing zero JS as goal is self-deceptive
- Not advocating for bloated apps with excessive JavaScript
CSS vs JavaScript Comparison
- JavaScript expectation same as HTML/CSS
- "Zero CSS" websites technically possible but nobody should use them
- Poor user experience without CSS universally accepted
- Zero JS websites get praised (Alex Russell congratulations mentioned)
- Double standard in community attitudes
JavaScript-Powered "Zero JS" Solutions
- HTMX and LiveView are awesome but use JavaScript
- These solutions work because they run JavaScript bundles
- Allow backend to change client content via JavaScript
- User doesn't write JS but experiences only work because JS running
- Best "zero JS" solutions actually better with JS
Performance Reality Check
- Very few websites can't provide better experience with JavaScript
- Going from 2MB to 0KB JavaScript better than staying at 2MB
- Not much better than going from 2MB to 100KB JavaScript
- Fear of bloated JS apps caused overcorrection in opposite direction
- Reality somewhere in middle
Framework Examples and Balance
- Remix allows form submission without JavaScript loading
- Can load JavaScript for enhanced client experience
- Shouldn't build Remix with zero JS mindset
- Should focus on good performance and user experience
- Some app functionality will break without JavaScript
Accessibility and JavaScript
- Accessibility often improved with JavaScript
- Browser behaviors make sites inaccessible without JavaScript assistance
- Modern frameworks (Remix, Next, Gatsby, Astro) make building accessible, performant sites easier
- May ship more JavaScript but bundle caches for incredible future experience
- Slightly degraded experience until JS loads, but brief duration
Personal Philosophy and Conclusion
- Author removes unnecessary things (infrastructure-free 3 years, avoids classes, removes "this")
- JavaScript necessary and essential for good accessible performant web experiences
- Shouldn't strive for zero KB JavaScript just because possible
- Will always include JavaScript in shipped applications
- Applications built for users, not Twitter flexes
- User happiness and experience prioritized over bundle size criticism
