Skip to content

Component that returns an array is not recognised #365

Open
@lensbart

Description

@lensbart

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions