react.js中组件之间的路由

时间:2017-01-17 06:35:49

标签: reactjs react-router

嗨我有这样的反应组件与路线。当我转到localhost:8000时,它会正确加载A组件,但是当我尝试localhost:8080/broute时,它会无法正常工作。
我怎样才能让它发挥作用?

import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, Link, browserHistory, IndexRoute, hashHistory     } from 'react-router'
import A from './components/A.jsx'
import B from './components/B.jsx'

ReactDOM.render((
  <Router history = {browserHistory}>
    <Route path = "/" component = {A}>
      <IndexRoute component = {A}/>
      <Route path = "broute" component = {B} />
    </Route>
  </Router>
), document.getElementById('app'))

0 个答案:

没有答案