使用 react-router 时出现以下错误:-
谁能告诉我我错在哪里?
未捕获的错误:不变违规:元素类型无效:预期为字符串(对于内置组件)或类/函数(对于复合组件)但得到:对象。
var React = require('react');
var ReactDOM = require('react-dom');
var Router = require('react-router');
var Route = Router.Route;
var App = React.createClass({
render: function(){
return (
<div>
<h1>Welcome</h1>
{this.props.children}
</div>
);
}
});
var Login = React.createClass({
render: function(){
return (
<div className="large-3 medium-6 large-centered medium-centered columns">
<h1>Login Page</h1>
</div>
) }
});
ReactDOM.render((
<Router>
<Route path="/" component={App}>
<Route path="login" component={Login}/>
</Route>
</Router>
), document.getElementById('content'));