Skip to Main Content
Mastering React Test-Driven Development - Second Edition
book

Mastering React Test-Driven Development - Second Edition

by Daniel Irvine
September 2022
Intermediate to advanced content levelIntermediate to advanced
564 pages
9h 56m
English
Packt Publishing
Content preview from Mastering React Test-Driven Development - Second Edition

4

Test-Driving Data Input

In this chapter, you’ll explore React forms and controlled components.

Forms are an essential part of building web applications, being the primary way that users enter data. If we want to ensure our application works, then invariably, that’ll mean we need to write automated tests for our forms. What’s more, there’s a lot of plumbing required to get forms working in React, making it even more important that they’re well-tested.

Automated tests for forms are all about the user’s behavior: entering text, clicking buttons, and submitting the form when complete.

We will build out a new component, CustomerForm, which we will use when adding or modifying customers. It will have three text fields: first name, last name, and ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Full-Stack Web Development with GraphQL and React - Second Edition

Full-Stack Web Development with GraphQL and React - Second Edition

Sebastian Grebe

Publisher Resources

ISBN: 9781803247120Supplemental Content