I'm having trouble getting RouteHandler to import correctly. This is my code:
var React = require('react');
var ReactDOM = require('react-dom');
var ReactRouter = require('react-router');
var ActivityView = require('./ActivityView');
var Router = ReactRouter.Router;
var Route = ReactRouter.Route;
var Link = ReactRouter.Link;
var RouteHandler = ReactRouter.RouteHandler;
var hashHistory = ReactRouter.hashHistory;
var IndexRoute = ReactRouter.IndexRoute;
var App = React.createClass({
render: function() {
return (
<div>
<div className="navbar navbar-default">
<ul className="nav navbar-nav navbar-right">
<li><Link to="app">Dashboard</Link></li>
</ul>
</div>
<RouteHandler />
</div>
);
}
});
ReactDOM.render(
<Router history={hashHistory}>
<Route name="app" path="/" component={App}>
<IndexRoute component={ActivityView} />
</Route>
</Router>,
document.getElementById('content')
);
I keep getting the error:
Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of
App
.
If I remove <RouteHandler />
this warning goes away and the navbar renders. Am I importing RouteHandler incorrectly here?