说,我有2个页面,localhost和localhost / test,localhost上有一个链接,这是localhost / test。
可以通过点击链接访问localhost / test,但是当刷新或手动输入url localhost / test时,它会返回
Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
我的代码是这样的:
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, IndexRoute, Link, IndexLink, browserHistory } from 'react-router';
import session from 'express-session';
import $ from 'jquery';
const App = React.createClass ({
render() {
return (
<div>
Router lza.
<ul>
<li><Link to="test">Test</Link></li>
</ul>
</div>
);
}
})
const App2 = React.createClass ({
render() {
return (<div>Router lza.aasss</div>);
}
})
var routes = (
<Router history={browserHistory}>
<Route path="/">
<IndexRoute component={App} />
<Route path="/test" component={App2} />
</Route>
</Router>
)
ReactDOM.render(routes, document.getElementById("hello"))
如何解决?
我尝试通过快递4来解决它,但是当我从表达&#39;中导入快递时,它会报告
Uncaught TypeError: Cannot read property 'prototype' of undefined
因此我尝试了快速会话,但我找不到如何使用它的完整示例。许多示例都有一个名为“应用程序”的变量,但它是如何定义的?或者,请告诉我如何刷新时可以访问网址。谢谢。