我收到此错误:-
未捕获的类型错误:无法读取
此代码中未定义的属性“createRouteFromReactElement” 。我使用路由器进行导航但无法正常工作。我导入了一个名为 Home.jsx 的文件
var React = require('react')
var ReactDOM = require('react-dom')
var Router = require('react-router').Router
var Route= Router.Route
var IndexRoute = Router.IndexRoute
var App = React.createClass({
render() {
return (
<div>
<p>App</p>
<ul>
<li>About</li>
</ul>
</div>
)
}
})
var About = require('./components/Home')
ReactDOM.render((
<Router>
<Route path="/" component={App}>
<IndexRoute path="/about" component={About} />
</Route>
</Router>
), document.body)
和 Home.jsx
var React = require('react');
var RaisedButton = require('material-ui/lib/raised-button');
var Home = React.createClass({
render:function() {
return (
<RaisedButton label="Default" />
);
},
});
module.exports = Home;