reactjs react-router:无法获得财产' route'未定义或空引用

时间:2017-03-25 05:49:50

标签: reactjs react-router

我是reactjs初学者,我正在尝试反应路由器。 这是我的代码。

Main.js

import React from 'react';
import ReactDOM from 'react-dom';
import ReactRouter from 'react-router';

var Route = ReactRouter.Route
var Router = ReactRouter.Router;
var browserHistory = ReactRouter.browserHistory;
var IndexRoute = ReactRouter.IndexRoute;

import App from './App.jsx';
import Home from './Home.jsx';
import About from './About.jsx';
import Contact from './Contact.jsx';



ReactDOM.render((
<Router history = {browserHistory}>
  <Route path = "/" component = {App}>
     <IndexRoute component = {Home} />
     <Route path = "home" component = {Home} />
     <Route path = "about" component = {About} />
     <Route path = "contact" component = {Contact} />
  </Route>
</Router>


), document.getElementById('app'));

错误代码:SCRIPT5007:无法获取财产&#39;路线&#39;未定义或空引用。感谢

0 个答案:

没有答案