- 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
- Instant Testing with CasperJS
- 深入理解Bootstrap
- Access 數據庫應用教程
- JMeter 性能測試實戰(第2版)
- Bulma必知必會
- 64位匯編語言的編程藝術
- Mastering Python Networking
- 從0到1:Python數據分析
- 用戶體驗增長:數字化·智能化·綠色化
- Getting Started with Laravel 4
- 基于ARM Cortex-M4F內核的MSP432 MCU開發實踐
- 匯編語言編程基礎:基于LoongArch
- Fast Data Processing with Spark(Second Edition)
- Unity Android Game Development by Example Beginner's Guide
- Ext JS 4 Plugin and Extension Development