Error in addon-docs prop table when using HOC
See original GitHub issueDescribe the bug
When using HOCs, the PropTypes aren’t correctly displayed in the addon-docs
prop table.
Instead, the following error is displayed:
Cannot read property ‘classes’ of undefined
To Reproduce Steps to reproduce the behavior:
- Create an HOC.
- Create a story for this component
Expected behavior The prop table should be filled with the component’s proptypes.
Screenshots
Code snippets
class Alert extends React.Component { ... }
Alert.propTypes = {
variant: PropTypes.string,
dismissible: PropTypes.bool,
icon: PropTypes.elementType,
classes: PropTypes.object.isRequired
};
Alert.defaultProps = {
variant: 'primary',
dismissible: false,
};
export default withStyles(theme => ({
alert: props => ({
backgroundColor: theme.palette[props.variant].main
}),
message: {
display: 'flex',
alignItems: 'center',
},
icon: {
marginRight: theme.spacing(2),
}
}))(Alert);
System:
System:
OS: Windows 10 10.0.18362
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Binaries:
Node: 10.16.0 - C:\Program Files\nodejs\node.EXE
npm: 6.10.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 44.18362.449.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Storybook Docs with mdx support and addon knobs - Medium
In the component's mdx page, I give examples of the component. Prop Tables. Prop tables on the documentation pages are much improved. These...
Read more >@storybook/react-native - npm
Fixes issue #601 where it throws error when introduce a propType with a hypen. Add a fix to babel-plugin-react-docgen to fix this issue....
Read more >@storybook/react | Yarn - Package Manager
Storybook for React: Develop React Component in isolation with Hot Reloading. storybook. readme. Storybook. Build bulletproof UI components faster. Build Status ...
Read more >How to enable prop-types in production for a React Storybook ...
When running the storybook locally, everything works perfectly. The prop-types are detected and this table is generated. SpinningLoader.
Read more >uselocation cannot read properties of undefined (reading 'location ...
To get the current location use the useLocation hook. ... Login in withRouter HOC to make sure `router` prop is available export default...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any update on this issue? It just doesn’t make sense to add unnecessary exports to the code just to document it properly 🤷🏻♂️
@gforrest-bw absolutely. hopefully we can address this in january as a high-priority bug.