0
我測試了React-Router,目前我所有的代碼都在index.html文件中。當我運行應用程序時,出現以下錯誤:反應路由器給出錯誤無法讀取屬性'getCurrentLocation'
Uncaught TypeError: Cannot read property 'getCurrentLocation' of undefined
at Object.createTransitionManager (ReactRouter.min.js:1)
at Object.componentWillMount (ReactRouter.min.js:1)
at react-dom.js:4802
at measureLifeCyclePerf (react-dom.js:4529)
at ReactCompositeComponentWrapper.performInitialMount (react-dom.js:4801)
at ReactCompositeComponentWrapper.mountComponent (react-dom.js:4712)
at Object.mountComponent (react-dom.js:11542)
at ReactCompositeComponentWrapper.performInitialMount (react-dom.js:4825)
at ReactCompositeComponentWrapper.mountComponent (react-dom.js:4712)
at Object.mountComponent (react-dom.js:11542)
這是我的代碼。請注意,此代碼位於index.html文件內。
var App = React.createClass({
render: function() {
return (
<div>
<h1>My App</h1>
<ul>
<li>Home</li>
<li>Stuff</li>
<li>Contact</li>
</ul>
<div>
content
</div>
</div>
);
}
});
ReactDOM.render(
<ReactRouter.Router>
<ReactRouter.Route path="/" component={App}>
</ReactRouter.Route>
</ReactRouter.Router>,
container
);
</script>
嘗試刪除'歷史= {hashHistory}' – Kenan
@Kenan由於看到更新後與更新的錯誤。 –