Skip to content

Component that returns an array is not recognised #1365

@lensbart

Description

@lensbart

Current behavior

Components that return an array lead to the following error:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    react-docgenIssues in react-docgen library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions