O'Reilly logo

React 16 Tooling by Adam Boduch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Validating component properties and state

React was designed with Flow static type-checking in mind. The most common use of Flow in React applications is to validate that component properties and state are being used correctly. You can also enforce the types of components that are allowed as children of another component.

Prior to Flow, React would rely on the prop-types mechanism to validate values passed to components. This is now a separate package from React and you can still use it today. Flow is a superior choice over prop-types because it performs checks statically whereas prop-types performs runtime validation. This means that your application doesn't need to run superfluous code during runtime.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required