-
-
Notifications
You must be signed in to change notification settings - Fork 305
Closed
Description
Hi,
I have a stateless component wrapped in a HOC written like this:
import React, { PropTypes } from 'react';
import extendStyles from 'enhancers/extendStyles';
const Test = props =>
<div style={props.style}>
Hello world!
</div>;
Test.propTypes = {
style: PropTypes.object,
};
export default extendStyles(Test);
Unfortunately, when I try to parse it I get Error: No suitable component definition found.
If I remove the HOC, the component is parsed.
My HOC looks like this:
import React, { PropTypes } from 'react';
import deepExtend from 'deep-extend';
export default (WrappedComponent, styles = {}) => {
const Enhancer = (props) => {
const computedStyles =
typeof styles === 'function' ?
styles(props) :
styles;
const style = deepExtend({}, computedStyles, props.style);
return <WrappedComponent {...props} style={style} />;
};
Enhancer.propTypes = {
style: PropTypes.object,
};
Enhancer.defaultProps = {
style: {},
};
Enhancer.displayName =
WrappedComponent.displayName ||
WrappedComponent.name ||
'Component';
return Enhancer;
};
I'm not sure how I can change the code so that docgen will parse it. I'm open to making changes in the HOC, but would rather not change the way the component is written if possible.
Sorry for the code dump, but hoping it will help in repro or someone will see something obvious.
Metadata
Metadata
Assignees
Labels
No labels