Skip to content

Select does not work on React versions below 16 #150

@aravindet

Description

@aravindet

The Select examples from the Styleguide should render on React 15.6.

Reality

Uncaught Error: FieldContainer.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.

It returns an array, because FieldContainer.render() (at https://github.com/zendeskgarden/react-components/blame/master/packages/selection/src/containers/FieldContainer.js#L86) calls the anonymous render prop function in SelectField (at https://github.com/zendeskgarden/react-components/blob/master/packages/select/src/elements/SelectField.js#L63-L92) which returns React.Children.map(...).

React.Children.map() returns an array.

For comparison, the TextField's render prop function wraps the array returned by React.children.map() in a <TextGroup>, which avoids this problem. TextField works fine in React 15.6.

Fine Print
  • Component: SelectField
  • Browsers: all

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions