Error: Element type is invalid: expected a string
Olivr3 opened this issue · 1 comments
Olivr3 commented
The latest version is throwing an error when using it with react-router-dom
index.js
import 'babel-polyfill'
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
// import { Router, Route } from 'react-router'
import { syncHistoryWithStore, ConnectedRouter } from 'react-router-redux'
import { Switch, Route } from 'react-router-dom'
import createHistory from 'history/createBrowserHistory'
import App from './App'
const StoreInstance = store()
const history = syncHistoryWithStore(createHistory(), StoreInstance)
render(
<Provider store={StoreInstance}>
<ConnectedRouter history={history}>
<Switch>
<Route path="/" name="Home" component={App} />
</Switch>
</ConnectedRouter>
</Provider>,
document.getElementById('root'),
)
store.js
import { createStore, applyMiddleware, compose } from 'redux'
import createSagaMiddleware from 'redux-saga'
import rootReducer from './reducers'
import { helloSaga } from './sagas'
export default (initialState) => {
const sagaMiddleware = createSagaMiddleware()
const composeEnhancers =
typeof window === 'object' &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
}) : compose
const enhancer = composeEnhancers(applyMiddleware(sagaMiddleware))
const store = createStore(rootReducer, initialState, enhancer)
sagaMiddleware.run(helloSaga)
return store
}
package.json
"history": "^4.7.2",
"react": "16.1.1",
"react-chartjs-2": "2.6.4",
"react-dom": "16.1.1",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-router-redux": "^4.0.8",
"react-transition-group": "2.2.1",
"reactstrap": "5.0.0-alpha.4",
"redux": "^3.7.2",
"redux-saga": "^0.16.0",
"redux-thunk": "^2.2.0",
timdorr commented
This is a bug tracker, not a support system. For usage questions, please use Stack Overflow or Reactiflux where there are a lot more people ready to help you out. Thanks!
