StephenGrider / Lyrical-GraphQL

Starter project from a GraphQL course on Udemy.com
198 stars 371 forks source link

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

Open jobypthomas opened 6 years ago

jobypthomas commented 6 years ago

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 commented 4 years ago

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 commented 3 years ago
must have exactly one child, and more than one must be wrapped in a , ``` // Your code ```