it must be a function, usually from React.PropTypes

You have an error: React.PropTypes.string.isRequred. Spell isRequired correctly, and it should be ok.


This happens when your PropType is actually undefined.

In my case I had specified a propType of PropTypes.integer, which is not one of the list of proptypes. That literally turns into undefined. Instead I should have used PropTypes.number.

Watch out for similar mistakes with PropTypes.bool vs PropTypes.boolean, as well as PropTypes.func vs PropTypes.function.


Also, it's bool for booleans. I skimmed the docs and had the exact same problem until I went back and read them carefully.

https://facebook.github.io/react/docs/typechecking-with-proptypes.html

Tags:

Reactjs