From the course: React: Ecosystems

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Types

Types

- Finally on our list and in the same vain as jest we have type checking. This might be a new concept so let me explain. In very simple terms type checking allows us to specify the type of data our variables, objects, or functions are expecting. It adds another tool for application efficiency and bug prevention. For example, my variable, my number is expecting a number. If I pass a string, and a number to my variable which is expecting a number well, you've been warned. So in other words, when you pass value that is not of the expected type you might be in trouble. The benefit of using type checking is to eliminate a lot of the bugs. Or, understand why your code may not work as expected. Along with the previous tools mentioned you've got everything you need to prevent alarms from going off. With React, there are two ways to do type checking. You can use a simple library called proptypes to get started. Or, if you want a more robust API to do type checking you can use flow. Both…

Contents