Open
Description
Often times a callback prop is assigned an empty function (() => {}
) as the default value. The showDefaultProps
method is simply looking for equality (I believe), so it won't catch a default prop that is just an empty function. In those cases, I had to add some logic in the filterProps
property to make those not appear but I don't think this is the best solution and I would love it if the showDefaultProps
would catch those as well or if there was another option I can set so those empty functions don't show up in the generated string.
filterProps: value => {
// Omit empty functions (they're likely from default props and `showDefaultProps` doesn't catch those)
if (!isFunction(value)) {
return true;
}
return value.toString() !== '() => {}';
},
Metadata
Metadata
Assignees
Labels
No labels