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

Uncaught Error: React.Children.only expected to receive a single React element child. #13

Open
jobypthomas opened this issue May 21, 2018 · 2 comments

Comments

@jobypthomas
Copy link

jobypthomas commented May 21, 2018

When added the following code:

<ApolloProvider client = {client}> 
  <SongList />
</ApolloProvider>

);

Error raised:

bundle.js:356 Warning: Failed prop type: Invalid prop children of type array supplied to ApolloProvider, expected a single ReactElement.
in ApolloProvider (created by Root)
in Root
printWarning @ bundle.js:356
warning @ bundle.js:380
checkReactTypeSpec @ bundle.js:23382
validatePropTypes @ bundle.js:9514
createElement @ bundle.js:9557
Root @ bundle.js:10124
(anonymous) @ bundle.js:14175
measureLifeCyclePerf @ bundle.js:13944
_constructComponentWithoutOwner @ bundle.js:14174
_constructComponent @ bundle.js:14149
mountComponent @ bundle.js:14057
mountComponent @ bundle.js:2649
performInitialMount @ bundle.js:14240
mountComponent @ bundle.js:14127
mountComponent @ bundle.js:2649
mountComponentIntoNode @ bundle.js:8196
perform @ bundle.js:4260
batchedMountComponentIntoNode @ bundle.js:8218
perform @ bundle.js:4260
batchedUpdates @ bundle.js:17871
batchedUpdates @ bundle.js:1283
_renderNewRootComponent @ bundle.js:8412
_renderSubtreeIntoContainer @ bundle.js:8493
render @ bundle.js:8514
_hyphenPattern @ bundle.js:10133
webpack_require @ bundle.js:20
module.exports @ bundle.js:66
(anonymous) @ bundle.js:69
bundle.js:305 Uncaught Error: React.Children.only expected to receive a single React element child.
at invariant (bundle.js:305)
at Object.onlyChild [as only] (bundle.js:23428)
at ApolloProvider.render (bundle.js:11678)
at bundle.js:14665
at measureLifeCyclePerf (bundle.js:13944)
at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (bundle.js:14664)
at ReactCompositeComponentWrapper._renderValidatedComponent (bundle.js:14691)
at ReactCompositeComponentWrapper.performInitialMount (bundle.js:14231)
at ReactCompositeComponentWrapper.mountComponent (bundle.js:14127)
at Object.mountComponent (bundle.js:2649)

@saulwiggin
Copy link

Hi. I got the same issue. Looking for an answer to this. My code is
`Uncaught Error: React.Children.only expected to receive a single React element child.
at invariant (/Users/drsilaswiggin…t.development.js:88)
at onlyChild (/Users/drsilaswiggin…development.js:1236)
at Object.React$$1.Children.only (renderer.dev.js:29190)
at AppContainer (/Users/drsilaswiggin…production.min.js:1)
at ProxyFacade (renderer.dev.js:27460)
at renderWithHooks (/Users/drsilaswiggin…evelopment.js:12938)
at mountIndeterminateComponent (/Users/drsilaswiggin…evelopment.js:15020)
at beginWork (/Users/drsilaswiggin…evelopment.js:15625)
at performUnitOfWork (/Users/drsilaswiggin…evelopment.js:19312)
at workLoop (/Users/drsilaswiggin…evelopment.js:19352)
'

@moustaouiSalaheddine
Copy link

moustaouiSalaheddine commented Nov 4, 2021

must have exactly one child, and more than one must be wrapped in a ,

<ApolloProvider >
     <View>
          // Your code
         <SongList />
     </View>
</ApolloProvider >

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

3 participants