To run typechecking on the props for a component, you can assign the special propTypes property: import PropTypes from 'prop-types'; class Greeting extends React.
PropTypes exports a range of validators that can be used to make sure the data you receive is valid.
Validation failed. This syntax has not yet been finalized though and will require a compilation step to work within a browser. For more information, see the class fields proposal.
The propTypes typechecking happens after defaultProps are resolved, so typechecking will also apply to the defaultProps.
Function Components If you are using function components in your regular development, you may want to make some small changes to allow PropTypes to be proper applied.