In this lesson, you will learn to use an important React feature called
propTypes are useful for two reasons. The first reason is prop validation.
Validation can ensure that your
props are doing what they're supposed to be doing. If
props are missing, or if they're present but they aren't what you're expecting, then a warning will print in the console.
This is useful, but reason #2 is arguably more useful: documentation.
props makes it easier to glance at a file and quickly understand the component class inside. When you have a lot of files, and you will, this can be a huge benefit.
Click Next to learn how to use