我正在研究一个示例并制作反应路由器。下面是我的代码。但是当我运行我的代码时,它在 <Router> 的开头行给我错误“Unexpected syntax”。下面是代码:
var React = require('react');
var ReactRouter = require('react-router');
var Router = ReactRouter.Router;
var Route = ReactRouter.Route;
var Base = require('./components/base.jsx');
var PageOne = require('./components/pageone.jsx');
var PageTwo = require('./components/pageTwo.jsx');
var Route = function(){
<Router>
<Route path="/PageOne" component= {PageOne}></Route>
<Route path="/pageTwo" component= {PageTwo}></Route>
</Router>
}
module.exports = Route;
任何人都可以检查并让我知道我在哪里做错了吗?
谢谢, 内哈