You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see the object provided for the bar property doesn’t have a property something which is used in the render function.
To avoid such mistakes it would be better to use React.PropTypes.shape and describe how the object should look like:
Using
React.PropTypes.object
orReact.PropTypes.array
is quite unspecific, it tells you nothing about the actual content of a property.Example:
As you can see the object provided for the
bar
property doesn’t have a propertysomething
which is used in therender
function.To avoid such mistakes it would be better to use
React.PropTypes.shape
and describe how the object should look like:I propose a rule that forbids every usage of:
React.PropTypes.object
which should be replaced byReact.PropTypes.shape
React.PropTypes.array
which should be replaced byReact.PropTypes.arrayOf
The text was updated successfully, but these errors were encountered: