reactjs - is specifying isRequired in Proptypes should come at last? -


i have simple component, , i'm utilizing prop-types package.

to validate array of objects, use like:

coursespage.proptypes = {     courses: proptypes.isrequired.arrayof(proptypes.shape({         title: proptypes.isrequired.string,     })), }; 

now, eslint react/require-default-props give me error courses property optional not have default value, if isrequired comes after arrayof property, error gone.

in order make prop required, required stipulate isrequired property @ last? or bug eslint react/require-default-prop plugin?

isrequired should come after data type proptypes.string.isrequired you can read more here

in case

coursespage.proptypes = {     courses: proptypes.arrayof(proptypes.shape({         title: proptypes.string,     })).isrequired }; 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -