AI summary by TwinMind
React Doesn't Scale
Theo - t3․gg
1h 5m 14s
Initial Reddit Post Analysis
- Post from r/experiencedevs about "chaos of react in medium to large web apps"
- Author worked with React exclusively since 2016 across 6-7 companies
- Claims inherited code quality was "always atrocious" for medium/large apps
- Argues Angular projects were easier to manage as they grew
- Estimates 50+ engineers worked with, only 5-10 truly understood React
- Includes ex-PayPal and ex-Twitter engineers who struggled with React
Sponsor Segment
- Convex sponsorship demonstration
- Real-time dashboard example with orange searches and dog tagging
- Convex handles full-stack state, generates data models and APIs
- Type-safe like tRPC, auto-updates on changes
Critique of Engineer Quality Claims
- Questions assumption that ex-FAANG engineers are automatically good
- Points out engineers may have left companies for performance reasons
- Distinguishes between CS knowledge and code organization skills
- Cites example of Stanford CS master's degree holder with poor code readability
- Argues CS expertise doesn't translate to scaling code bases
React's Open Model Discussion
- Acknowledges React's openness enables chaos but also flexibility
- Contradicts claim about "React team intentions" - team doesn't prescribe strict patterns
- Example of MobX creator working at Meta despite disagreeing with React philosophy
- Compares React to programming language rather than framework
Bias in Code Base Experience
- Author likely works as contractor fixing broken code bases
- Similar to Alex Russell's experience helping teams with performance issues
- Disproportionately exposed to worst-case scenarios
- Good React engineers leave bad code bases for better opportunities
- Selection bias: only sees code bases that need external help
Hook Usage Problems Analysis
Use Effect Issues
- Most developers use useEffect incorrectly
- React docs have "You Might Not Need an Effect" section
- Common mistake: using effects to transform data for rendering
- Example: creating fullName state variable instead of computed value
- Pattern comes from class-based thinking requiring everything in hooks
Use State Misuse
- Adding things to state that should be derived variables
- Creating multiple states for related data instead of objects
- State duplication when passing downstream as props
- Treating state like variables from other paradigms
Use Memo and Use Callback
- Often misused by not being used (performance problems) or overused (worse performance)
- Developers don't understand difference between useCallback and inline functions
- Both allocate new functions, useCallback adds overhead if dependencies unchanged
- React compiler will help solve these issues
Use Ref Problems
- Using refs to hold values that should be in state/props
- Leads to hard-to-follow code
- Brain rot from assuming all dynamic values need hooks
Class Components vs Hooks Comparison
- Demonstrates class component complexity with constructor, binding, lifecycle methods
- Shows hook simplicity with custom hook abstraction (useNameExample)
- Class components require spreading concerns across multiple lifecycle methods
- Hooks allow encapsulating related logic in single custom hook
- Reusability: hooks can be extracted and reused, class logic cannot
Code Review and Learning Process
- React code is highly reviewable due to component isolation
- Learned React at Twitch through thorough code reviews and mentorship
- Culture of asking "why did you think that was the right decision?"
- React's structure makes it easier to identify issues in code review
- Contrast with jQuery/Angular where changes affect multiple files
Separation of Concerns Critique
- Strong disagreement with "separation of concerns" argument
- Term is misused and leads to worse code reviews and debugging
- Separated concerns make features ship slower and debugging harder
- Real separation should be at component level, not arbitrary technology divisions
- Teams are organized by features (chat, safety, design) not by MVC layers
Component Architecture Patterns
- Large components can be better than excessive prop drilling
- Prop drilling vs context usage discussion
- Children pattern as solution to prop drilling
- Component composition over deep nesting
- 3-5 level prop drilling indicates architectural problems
JSX and Business Logic
- JSX adoption across frameworks shows its superiority
- Even Astro moved from custom markup to JSX
- Business logic in render is feature, not bug
- Loops and ternaries make components more readable
Context Usage Issues
- Dozens of contexts often from external providers (analytics, auth, error management)
- Forcing global patterns into non-global framework creates problems
- Context misuse as global store replacement
Framework Evolution and Stability
- React maturity allows using old code alongside new patterns
- Gradual migration vs forced rewrites
- Module federation enables sharing components across different React versions
- Stability through component isolation reduces blast radius of changes
Developer Skill and Mental Models
- Fundamental problem: developers can't evolve past imperative thinking
- Class components tell you what to do, hooks require understanding state flow
- Need to think about state lifecycle, not component lifecycle
- 200+ contributor app requires containing bad patterns and building horizontal concerns
