No suitable component definition found
See original GitHub issueI know this is not an issue specifically with react-styleguidist, for example: https://github.com/reactjs/react-docgen/issues/29
This happens in a lot of cases: when extending/composing components, or when using Redux and the connect()
wrapper. For example, the following component is not recognised:
class Theme extends Component {
// ...
render() {
// ...
}
}
function mapStateToProps(state) {
const variables = selectVariables(state.theme.name)
return {
variables: selectVariables(state.theme.name),
styles: selectStyles(state.theme.name, variables)
}
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(ThemeActions, dispatch)
}
export default connect(mapStateToProps, mapDispatchToProps)(Theme)
When using wrappers, we could use two files: _Theme.jsx
(export “raw” component and use it for styleguide), and Theme
(that uses wrappers etc.). However it would be great if it just work.
Any ideas on what needs to be done?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:3
- Comments:27 (18 by maintainers)
Top Results From Across the Web
Troubleshooting DSM Storybook error "No suitable ...
When trying to publish a Storybook story to DSM, you may encounter the following error: No suitable component definition found.
Read more >Understanding Dash Custom Components Architecture
except the process complains: Error: No suitable component definition found . It appears this error comes from react-docgen, and that that tool ...
Read more >vue-docgen-api: failed to parsed when exported component ...
[vue-docgen-loader] failed to parse the component file with docgen-api: No suitable component definition found on... To reproduce.
Read more >How to use the react-docgen.resolver function in react ... - Snyk
Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately. Enable here ... 'No suitable...
Read more >No suitable component definition found for ... - Bountysource
react-docgen can't find a component definition when the component is defined as a higher-order component: import React from 'react'; ...
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 Free
Top 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
@jameslaneconkling This looks like a bug in react-docgen.
Documenting this here in case it’s of help to anyone.
Returning a ternary from a stateless component threw the
No suitable component definition found
Error.Refactoring to use an if statement fixed it: