Hi! 👋🏻 I’m Trevor Burnham, author of several books on JavaScript, most recently Test-Driven React: Second Edition (2024) and Secrets of the JavaScript Ninja: Third Edition (currently in Early Access). My areas of expertise run the gamut from UX to a11y to reliability and performance. I ❤️ making web apps better!
You can peruse my résumé on 👔 LinkedIn, follow me on 🦋 Bluesky and check out my open-source work on 🐙 GitHub.
If you have a project I might be interested in, 📬 email me.
Kent C. Dodds, creator of React Testing LibraryTest-Driven React goes into great detail on how to set up testing React components in modern applications. By following the steps Trevor has clearly outlined, you’ll be up and testing in no time.
Test-Driven React is a masterclass in setting up a productive development workflow, in such a simple, clear, and concise language that it’s a joy to read and reread.Tibor Simic, Senior Developer at IBM
An incredibly comprehensive guide to improving the testing and development workflows of React developers at any experience level.Adam Markon, Frontend Engineer at HubSpot
The spirit of test-driven development extends beyond writing tests before you write code. The goal is to set up a constructive feedback loop for yourself, to identify potential problems quickly and give yourself the freedom to explore potential improvements. Tests are only a means to that end. Sometimes, you’ll want to set tests aside and focus on other sources of feedback. The important thing is to always think ahead: before you start writing a piece of code, ask yourself what the most valuable feedback you could receive for that code would be. Then take steps to make it a reality.
Every time your eyes leave your code, you experience what’s known as a context switch. Returning to your code, it’s common to feel disoriented, even lost. A workflow that requires you to actively switch between your code and your tests will sap your ability to focus. Strive to make running your tests as automatic as breathing.
With the new code still fresh in your mind, you can experiment. Try a different approach. Use cleaner syntax. Refactor. As soon as you save, the test console will tell you if your revision is viable. With just a few extra minutes, you can almost always find a way to make your code better. More importantly, what you learn from these little ventures will make you a better coder.