-
-
Notifications
You must be signed in to change notification settings - Fork 296
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
No suitable component definition found for container component #336
Comments
That's because
@danez, any thoughts on extending the heuristic? |
There are two problems in this example:
I think adding support for |
Similar issue when returning a portal. Simplified example: const Dialog = (props) => {
return ReactDOM.createPortal(<MyDialogHere {...props}/>, document.body);
}
Dialog.propTypes = {
/** If only these docs could be detected... */
children: PropTypes.node
} The fragment workaround does work, but +1 for allowing the presence of |
I'm experiencing the same when returning a portal. Interestingly enough, it works when using a class component instead. |
Also ran into this problem with a functional component which returns |
I use the fragment workaround but with shorthand fragment |
Useful for "container" like components, similar to the downshift API. import * as React from 'react'
type Props = {
render: () => React.Element<any>,
}
function MyComponent({ render }: Props) {
return render()
}
export default MyComponent; I understand that with such case there's not much to rely on to distinguish a component from a function. Maybe the fact that react is imported? |
Inside functional component, if createPortal() method is used, be sure NOT to return null in the ternary operator. Instead of this,
use this,
This solved my problem. :) |
To add to the discussion, aside from
^ Fragment workaround works here too. e.g. |
output
The text was updated successfully, but these errors were encountered: