- Mastering React Test:Driven Development
- Daniel Irvine
- 480字
- 2021-06-24 14:45:01
First Steps with Test-Driven Development
This book follows a simple format: it's a walk-through of building React applications using a test-driven approach. We'll touch on many different parts of the React experience, including building forms, composing interfaces, and animating elements. We'll also integrate React Router, Redux, and GraphQL, all guided by tests. The focus isn't on how these features of React work, but rather on how to test them and make sure you're using them with confidence.
Modern JavaScript programmers rely heavily on packages that other people have developed. This allows us to concentrate on innovating, not reinventing, the wheel. The downside, however, is that we don't always have a full understanding of the technologies we’re dealing with. We simply don't need to learn them.
Among other things, Test-Driven Development (TDD) is an effective technique for learning new frameworks and libraries. That makes it very well suited for a book on React and its ecosystem. This book will allow you to explore React in a way that you may not have experienced before.
If you're new to TDD, some of the steps outlined may leave you scratching your head. You may find yourself wondering why we're going to such Herculean efforts to build an application. There is tremendous value to be gained in specifying our software in this way. By being crystal clear about our requirements, we gain the ability to adapt our code without fear of change. We gain automated regression testing by default. Our tests comment our code, and those comments are verifiable when we run them. We gain a method of communicating our decision-making process with our colleagues. And you'll soon start to recognize the higher level of trust and confidence you have in the code you're working on. If you're anything like me, you'll get hooked on that feeling and find it hard to work without it.
Sections 1 and 2 of this book involve building an appointments system for a hair salon—nothing too revolutionary, but as sample applications go, it offers plenty of scope. We'll get started with that in this chapter. Sections 3 and 4 use an entirely different application: a Logo interpreter. Building that offers a fun way to explore more of the React landscape.
This chapter, and in fact this whole book, takes a first principles approach to React. We start with minuscule steps to slowly uncover the TDD story. We'll prefer rolling our own code to using libraries and packages. We will start from an empty directory and begin building out our application, test by test. Along the way, we’ll discover a lot of the fundamental ideas behind test-driven development and React.
The following topics will be covered in this chapter:
- Creating a new React project from scratch
- Displaying data with your first test
- Refactoring your work
- Writing great tests
- Rendering lists and detail views
- Clojure Programming Cookbook
- iOS面試一戰到底
- ASP.NET Web API:Build RESTful web applications and services on the .NET framework
- .NET之美:.NET關鍵技術深入解析
- 大學計算機應用基礎實踐教程
- Julia Cookbook
- AutoCAD VBA參數化繪圖程序開發與實戰編碼
- Android傳感器開發與智能設備案例實戰
- 計算機應用基礎教程(Windows 7+Office 2010)
- 大學計算機基礎
- WebStorm Essentials
- Mastering PowerCLI
- Learning Shiny
- Microsoft XNA 4.0 Game Development Cookbook
- MySQL數據庫教程(視頻指導版)