React: PropTypes in stateless functional component
Solution 1:
You should change the casing on the property to propTypes
:
- List.PropTypes = {
+ List.propTypes = {
todos: PropTypes.array.isRequired,
};
Correct:
List.propTypes = {
todos: PropTypes.array.isRequired,
};
(The instance of a PropTypes object is lowercase, but the Class/Type is uppercase. The instance is List.propTypes
. The Class/Type is PropTypes
.)