Summary

In this chapter, you learned about why type-checking your React code matters. You also learned about Flow—the tool used to type-check React code. Type-checking is important for React applications because it removes the need to perform runtime checks of values in the majority of cases. This is because Flow is able to statically follow code paths and determine whether everything is being used as intended.

Then, you installed Flow locally to a React application and learned how to run it. Next, you learned the basics of validating property and state values of React components. Then you learned how to validate function types and how to enforce child React component types.

Flow can be used in create-react-app dev server, but you have to eject first. In future versions of create-react-app, there will likely be better integrated support for running Flow as part of the dev server. Another option is to install a Flow plugin in a code editor such as Atom, and have errors displayed right in front of your eyes as you write your code.

In the following chapter, you'll learn how to enforce a high quality level with your React code with the help of tools.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.204.208