== Why is this an issue?

If the type of a ``++props++`` property is not defined there is a great chance one will wrongly use the value returned by the property and generate a not expected behavior of the application.


=== Noncompliant code example

[source,javascript]
----
class Rating extends React.Component {
  render() {
    return ( <div>{this.props.rating}</div> );
  }
}
----


=== Compliant solution

[source,javascript]
----
import PropTypes from 'prop-types';

class Rating extends React.Component {
  render() {
    return ( <div>{this.props.rating}</div> );
  }
}

Rating.propTypes = {
  rating: PropTypes.number.isRequired
};
----



ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

=== on 23 Feb 2018, 11:57:13 Alexandre Gigleux wrote:
Covered by ESLint for Reach: \https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/prop-types.md (react/prop-types)

endif::env-github,rspecator-view[]
