AI summary by TwinMind
Always Bet On React
Theo - t3․gg
9m 28s
JavaScript and React Evolution Context
- Douglas Crockford authored "JavaScript: The Good Parts" - made JavaScript taken seriously for real applications
- JavaScript evolved from "weird language to avoid" to dominating web and beyond
- React has spread everywhere JavaScript exists
- React pushing boundaries with server component model, challenging web developer norms
React's Community-Driven Approach
- Speaker gave talk at Reactathon: "The Future of React is Us"
- React's biggest strength: understanding community + closeness between team and community
- React-Vercel partnership not money-driven but because Vercel pushed React further than almost anyone
- Similar partnerships with Expo team on mobile for years without issue
- Current fear stems from fear of change
Angular 2 Comparison and Lessons
- Angular 2 hurt AngularJS developers despite being right move for web
- Angular 2 achievements:
- Made TypeScript the norm
- Moved away from MVC towards components
- Deprecated core AngularJS features for better model
- Pushed not just Angular devs but entire web forward
- Without Angular, unclear if/when TypeScript would have become standard
- Angular's "Red Wedding" was tough but important - moved web forward
React Server Components vs Single Page App Model
- SPA model put too much work on client
- Required rebuilding both front-ends and back-ends
- GraphQL caught on due to need for better front-end/back-end relationships
- New model: complexity is opt-in
- Can start from server code fetching from database
- Return HTML instead of JSON - "magic of new React model"
- Similar to old Rails approach but HTML can be client component or structure of updates
- Only re-render from certain points in application
- Granular control over when application converts from back-end to front-end
Backward Compatibility Demonstration
- Found old class component from 2014
- Made two small changes - still works in new model
- Server renders with "use client" directive
- Imported server action (newest Alpha with latest Next release)
- Server function only runs on server, imported into 2014 React code
- Demo: typing name/content, logs show "do work" printed only on server
- All new patterns work with old techniques and primitives
React's Unique Approach to Innovation
- Unlike other frameworks with risky innovations
- React maintains support for every core feature
- Code from 10 years ago runs in brand new React project with new patterns
- Even renders on the server
- Almost no frameworks have this level of interoperability
- If wrong direction, can continue maintaining apps built old way
- Just one more primitive to consider
Previous Limitations and Workarounds
- React was single page app model - everything ran on client
- Had "hacks" like Next.js, Gatsby, Remix:
- Hydrated entire page
- Shipped same JavaScript to client
- Ran on server once for HTML before JS runs
- New model eliminates these limitations
- Hacky techniques for server/client interoperability now baked into good primitives
- At Twitch: built hacky templating system overrun by React
- Common pattern when React bundles reach certain size
Server-First Philosophy
- Code is server-first and server-only by default
- Choose when things become interactive
- How it always should have been
- Previous adoption impossible because limiting client required owning server
- Next.js proved React developers ready to take over server
- React server component model leverages React's majority position
Market Position and Adoption Strategy
- React is incumbent majority holder of:
- Modern web projects
- Greenfield applications
- Using majority position to help front-end devs get buy-in for back-end work
- Other frameworks can build back-end frameworks but lack React's adoption level
- Buy-in being used as lever to push towards server
- Move optional - don't have to adopt if doesn't make sense
- Compelling for applications needing this approach
Personal Experience and Production Use
- Initially hesitant but now enthusiastic
- Built 3-4 production applications with new model
- "Will never be going back"
- Excited about other frameworks: Solid, Svelte
- Vercel balancing Svelte, hiring team to build SvelteKit
- SvelteKit making different bet than server components
Third Generation React Vision
- Multiple different approaches emerging
- React continues as major force
- Third generation React: excitement not fear
- Speaker talked with core team - driven by excitement
- Sebastian Markbage went to Vercel because React's future was server-focused
- Meta wasn't right place for that direction
Current State and Future Outlook
- Some weird edges, still figuring out pieces
- Overall puzzle incredible to work with
- Feels entirely different to use
- More things exist in model but complexity/depth much shallower
- Changes not required immediately to stay competent
- Server/client directives becoming standard bundling techniques
- Other frameworks like Solid can hook into these techniques
