我不明白browserHistory如何更改應用程序執行。這是代碼工作正常:與'react-router'.browserHistory我得到this.props.children == undefined
var React = require('react'),
ReactDOM = require('react-dom'),
Router = require('react-router'),
Route = Router.Route,
browserHistory = Router.browserHistory,
hashHistory = Router.hashHistory;
var Layout = React.createClass({
render: function() {
return (
<div>
<SideMenu />
{this.props.children}
</div>
)
}
});
var routes = (
<Router.Router history={hashHistory}>
<Route path="/" component={Layout}>
<Route path="auth/startpage" component={require('./startpage')}/>
</Route>
</Router.Router>
);
此代碼工作正常,但我得到哈希代碼到我的網址。所以,我只是改變hashHistory到browserHistory這樣的:
<Router.Router history={browserHistory}>
...,之後{this.props.children}
是不確定!沒有錯誤。反應0.14.7,react-router 2.0.0。請告訴我我錯過了什麼?