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
/** * The Badge */classBadgeextendsReact.PureComponent{staticpropTypes(){return{/** * The background of the Badge */background: PropTypes.string,/** * The text color for the Badge */color: PropTypes.string,/** * The text displayed inside the Badge */text: PropTypes.string,};}staticgetdefaultProps(){return{background: null,color: Colors.WHITE,};}render(){
...
}}exportdefaultBadge;
And it outputs like this (screenshot):
The text was updated successfully, but these errors were encountered:
Looks like react-docgen doesn’t understand your propTypes so it catches your props only from defaultProps and shows only default values because of that.
Actually I don’t see any reason to use a function here (didn’t know that this is possible for classes — do they even work?). Could you try to use an object like in this example.
My issue/problem:
It seems like
propTypes
Don't show up unless there is adefaultProps
for thatprop
. Is this intended? Is there a fix for this?Details:
"webpack": "1.12.14"
styleguide.config.js
:The text was updated successfully, but these errors were encountered: