Jjang Jjang - 1 month ago 35
React JSX Question

Invalid prop children in Provider

I've been learning React for the past several weeks.

First developed a simple Chat with plain React, and now I started integrating Redux into my app.

I added a simple Action, a matching Reducer (along with a root reducer) and a Store.
I then reached the part where I need to use the Provider from the react-redux library:

import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { Router, browserHistory } from 'react-router';
import ConfigureStore from './Store/ConfigureStore';
import Routes from './Routes';

const store = ConfigureStore();
ReactDOM.render(
<Provider store={store}>
<Router history={browserHistory}
routes={Routes} />,
</Provider>,
document.getElementById('root')
);


App compiles fine, but I receive the following errors in console:


Warning: Failed prop type: Invalid prop
children
of type
array
supplied to
Provider
, expected a single ReactElement.
in Provider


and


Uncaught Invariant Violation: React.Children.only expected to receive a single React element child.


I'm using the React Create App as a starter kit.

Full code can be found here.

Answer

You have a , after <Router history={browserHistory} routes={Routes} />

Try removing it?