Chapter 8: Validating Component Properties

In this chapter, you'll learn about property validation in React components. This might seem simple at first glance, but it's an important topic because it leads to bug-free components. We'll start things off with a discussion about predictable outcomes and how this leads to components that are portable throughout the application.

Next, we'll walk through examples of some of the type-checking property validators that come with React. Then, we'll walk through some more complex property-validation scenarios. Finally, we'll wrap this chapter up with an example of how to implement your own custom validators.

The following topics will be covered in this chapter:

  • Knowing what to expect
  • Promoting portable ...

Get React and React Native - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.