I have the following code:
import React from 'react';
import ReactDOM from 'react-dom';
import rootReducer from './redux/reducers/rootReducer';
import {Provider} from 'react-redux';
import {createStore, applyMiddleware} from 'redux';
import {BrowserRouter} from 'react-router-dom';
import thunk from 'redux-thunk';
import Main from './Main';
import './i18n';
const store = createStore(rootReducer,
{},
applyMiddleware(thunk));
ReactDOM.render(<Provider store={store}><BrowserRouter><Main/></BrowserRouter></Provider>, document.getElementById('app'));
But when I try to run it I get:
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of
Provider.
My Main class looks like this:
function mapStateToProps(state) {
return {
dashboard: state.dashboard
}
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(actions, dispatch)
}
const Main = withRouter(connect(mapStateToProps, mapDispatchToProps)(App));
export default Main;
What is the problem?