react-docgen icon indicating copy to clipboard operation
react-docgen copied to clipboard

Component that returns an array is not recognised

Open lensbart opened this issue 6 years ago • 1 comments

Current behavior

Components that return an array lead to the following error (via react-styleguidist):

Warning: some/folder/index.jsx matches a pattern defined in “components” or “sections” options in your style guide config but doesn’t export a component.

It usually happens when using third-party libraries, see possible solutions here: https://react-styleguidist.js.org/docs/thirdparties.html

To reproduce

/**
 * @param {Props} props props
 * @property {Array.<Etcetera>} etc
 * @returns {React.Node} ...
 */
const Contents = ({ contents }: Props) =>
	contents.map(data => {
		switch (data.__typename) {
			case 'Something':
				return (
					<Something children={data.children} key={data.id} />
				)
		}
	})

Expected behavior

No warning

Originally posted here

lensbart avatar May 21 '19 08:05 lensbart

Similar reason as https://github.com/reactjs/react-docgen/issues/336#issuecomment-474613378

fkling avatar Jun 05 '19 21:06 fkling