Hello,
I've got some problems setting up React-Router-Redux.
I'm just following the basic example on https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux#usage.
My App.jsx looks like this:
import React, { Component } from 'react';
import { Route, Switch } from 'react-router-dom';
import { Provider } from 'react-redux';
import { ConnectedRouter } from 'react-router-redux';
import createHistory from 'history/createBrowserHistory';
import Home from './containers/Home';
import About from './containers/About';
import store from './store';
const history = createHistory();
class App extends Component {
render() {
return (
<Provider store={store}>
<ConnectedRouter history={history}>
<div>
<Route exact path="/" component={Home}/>
<Route path="/about" component={About}/>
</div>
</ConnectedRouter>
</Provider>
);
}
}
export default App;
When I save this, I get the following error:
React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.
Check your code at App.js:25.
And line 25 is:
<ConnectedRouter history={history}>
Can someone help me out?
These are my dependencies:
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-router-redux": "^4.0.8",
"history": "^4.7.2",
"redux": "^3.7.2",
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!
@timdorr Isn't it a bug when I more or less copy your basic example, and it doesn't work?
@AndasDev make sure you're using version ^5.0.0-alpha.8 and not 4.x.x which gets installed by default with npm install.
Most helpful comment
@AndasDev make sure you're using version
^5.0.0-alpha.8and not4.x.xwhich gets installed by default withnpm install.