-
-
Notifications
You must be signed in to change notification settings - Fork 313
Open
Description
react-docgen can't find a component definition when the component is defined as a higher-order component:
import React from 'react';
const wrap = (CustomElement) => (props) =>
<CustomElement { ...props } >{ props.children }</CustomElement>
const Test = wrap('custom-element');
export default Test;> node_modules/.bin/react-docgen src/components/Test.jsx
Error with path "src/components/Test.jsx": Error: No suitable component definition found.
Error: No suitable component definition found.
at parse (/private/tmp/test/bindings/react/node_modules/react-docgen/dist/parse.js:84:9)
at Object.defaultParse [as parse] (/private/tmp/test/bindings/react/node_modules/react-docgen/dist/main.js:66:30)
at parse (/private/tmp/test/bindings/react/node_modules/react-docgen/bin/react-docgen.js:103:17)
at /private/tmp/test/bindings/react/node_modules/react-docgen/bin/react-docgen.js:204:30
at FSReqWrap.oncomplete (fs.js:153:5)
If I apply the function myself, react-docgen works as expected:
const Test = (props) =>
<custom-element { ...props } >{ props.children }</custom-element>> node_modules/.bin/react-docgen src/components/Test.jsx
{"description":"","displayName":"Test","methods":[]}
Tested with react-docgen@2.21.0.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels