-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Props with defaultProps of undefined
show up.
#96
Comments
This update allows `filterProps` to be a function (`(val: any, key: string) => boolean`). It also includes Typescript declaration file. A filterProps function (`filterProps: (val) => val !== undefined`) allows to hide props with defaultValue of `undefined`. Closes storybookjs#96.
While preparing the PR (#97) I noticed 14.3.0 wouldn't work. Since 14.3.1 was released and it includes the fixes needed (algolia/react-element-to-jsx-string#516) |
🚀 Issue was released in v7.1.14 🚀 |
🚀 Issue was released in v7.1.14 🚀 |
IMO this should be set as a default, or at least be added to the documentation. For those looking how to solve this, set this in your storybook configuration file: addParameters({
jsx: {
filterProps: val => val !== undefined,
},
}) |
I'm okay with that. Make a PR and i'll merge it! |
Story definition:
Storybook's JSX:
Looking for a solution I noticed a PR that just got merged in react-element-to-jsx-string, but react-element-to-jsx-string is locked to ^14.0.3.
It allows for
filterProps
to be a function, so one could exclude props where the value isundefined
.14.3.0 was just released. There are no breaking changes since 14.0.3, but features that might benefit the community.
The text was updated successfully, but these errors were encountered: