I see that Airbnb's style guide includes forbid-prop-types for type object. (as can be seen here)
Can someone explain why I would want to forbid the use of PropType.object?
Is it just that it's too vague? And if so, how can I be more specific?
Is it just that it's too vague?
Yes
And if so, how can I be more specific?
Basically, they're saying if you use object you should really be using shape so you can specify what the key/values of the object are.
// An object taking on a particular shape
myObject: React.PropTypes.shape({
color: React.PropTypes.string,
fontSize: React.PropTypes.number
}),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With