I am doing proptype check in my React.js code like this
const { a, b ,c } = this.props
where a, b, c are my objects or response coming from API
and in my propTypes check my code look's like
ComponentName.propTypes = {
a: PropTypes.objectOf,
b: PropTypes.objectOf,
c: PropTypes.objectOf,
};
in Default PropTypes assigning it like this
ComponentName.defaultProps = {
a: {
key1: '',
key2: '',
},
b: {
key3: '',
key4: '',
},
},
But when i am compiling my code it is giving me this error
type specification of prop
ais invalid; the type checker function must returnnullor anErrorbut returned a function. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)
Please can someone help in removing this warning from the console what can be the workaround
a: PropTypes.objectOf(PropTypes.string), b: PropTypes.objectOf(PropTypes.string), ...- Sahil Raj Thapaa.keyof typenumbersupplied toComponentName, expectedstring- Mayank Purohitnumberas props then usea: PropTypes.objectOf(PropTypes.number), ...- Sahil Raj Thapa