No suitable component definition found for container component
See original GitHub issuetype Props = {
children: React.Element,
renderStatus?: () => React.Element
};
function Test(props: Props, context) {
if (context.show) {
return props.renderStatus ? props.renderStatus() : null;
}
return props.children;
}
Test.contextTypes = {
show: PropTypes.bool
};
export default React.memo(Test)
output
Error: No suitable component definition found.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:9 (1 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 >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 >'Container' is not defined react/jsx-no-undef - Stack Overflow
You need to define Container first for example: import React from 'react' import styled from "styled-components"; const Container = styled.
Read more >Component Container definition files | Granitic reference
A component name must be unique within your application. Names must also follow the rules for Go variable name with one exception -...
Read more >Components Basics - Vue.js
When not using a build step, a Vue component can be defined as a plain ... In SFCs, it's recommended to use PascalCase...
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
There are two problems in this example:
I think adding support for
@react
is a good last resort. I will try to addpropTypes
,defaultProps
andcontextTypes
to the detection first.Similar issue when returning a portal.
Simplified example:
The fragment workaround does work, but +1 for allowing the presence of
propTypes
to trigger detection like @danez mentioned.