Reputation: 236
I'm new to React and React Router so I started off with some examples in the documentation. However, I keep getting error messages stating that the Router is undefined. When checking the ReactRouter object, I do not see a Router at all. I'm using browserify to load the react router.
I'm loading the ReactRouter and accessing the Router as follows:
var ReactRouter = require('react-router');
console.log(ReactRouter.Router); //This is undefined
Any ideas why the Router object is undefined in the code example above?
Upvotes: 2
Views: 562
Reputation: 159095
In 0.13.3, the export is the router. From this doc in the 0.13 branch:
var Router = require('react-router'); // or var Router = ReactRouter; in browsers
// ...
var Route = Router.Route;
// ...
var routes = (
<Route ...>
...
</Route>
);
Router.run(routes, function (Handler) {
React.render(<Handler/>, document.body);
});
Upvotes: 3