Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React 16. Invalid prop children of type array supplied to Provider, expected a single ReactElement. #803

Closed
peralmq opened this issue Oct 9, 2017 · 2 comments

Comments

@peralmq
Copy link

peralmq commented Oct 9, 2017

As I understand it the Provider requires a single ReactElement as stated here #561

But with the release of React 16 React now supports returning arrays from render.

Are there any plans to update the Provider to support this feature? If not, why, is there some other reasoning behind this requirement?

@timdorr
Copy link
Member

timdorr commented Oct 9, 2017

As long as we continue to support older versions of React, we will need to have this restriction in place.

This generally isn't an issue because <Provider> is normally placed at the top of the tree and there is usually a single child under it, either another wrapper component (such as a router) or the base "App" or "Root" component for your application.

@timdorr timdorr closed this as completed Oct 9, 2017
@peralmq
Copy link
Author

peralmq commented Oct 9, 2017

OK, thanks for the explanation. I understand, and agree that it's not the normal case to have something that returns an array directly within the Provider. And it's usually easy enough to work around it (just wrapping your array of React elements in an extra <div>...</div> for instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants