Getting Better All the Time: How to Escape Bad Code
summary
A 150-line React Native RestaurantList component gets refactored incrementally to add a per-row deleting loading state without a full rewrite. Tests run with Jest and React Native Testing Library using red‑green‑refactor/TDD to drive changes: extract handleAdd/handleDelete, convert promise chains to async/await, pull out a RestaurantRow child with local state, and fix an unmounted-state warning. The app demo shows add/delete working and tests remain green, demonstrating low-risk, stepwise improvement.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 1:04Problem with bad code
- 3:30Options for bad code
- 6:16Refactoring with tests
- 15:33Benefits of refactoring
- 17:40Test-driven development
- 28:21Visual changes with safety
- 29:44TDD benefits and effort
- 30:47Conclusion and call to action
related talks
45mReact refactoring, off the hook(s)!
34m90% Cleaner React
30mTesting React Applications
31mRewriting a Large Hybrid App with React Native
22mThe Art of ‘Humble Views’: Testing React Native Apps the Smart Way
30mTesting & React Native"Lessons from the Battlefield"
32mRefactoring React
28mLessons in Managing Technical Debt
