3 ms·
You're making some good points and I feel ambivalent about prop types however I wanted give a few solutions to some of the things you said. You can use eslint
by tym0 8y ago
You're making some good points and I feel ambivalent about prop types however I wanted give a few solutions to some of the things you said.
You can use eslint to enforce the use of prop types, it'll read through your code and will give you a warning if you are using a prop without a corresponding prop types declaration, the rule is called react/prop-types
You can us PropTypes.shape and PropTypes.exact to define the shape of props that are objects, see https://www.npmjs.com/package/prop-types https://www.npmjs.com/package/prop-types