刷新后着陆IndexRoute

land IndexRoute after refresh

本文关键字:IndexRoute 刷新      更新时间:2023-09-26

我正在用React Router编写SPA应用程序。

问题: 如何使我的应用程序在从signIn路径刷新后登录IndexRoute

ReactDOM.render((
    <Router history={History}>
        <Route path="/" component={App}>
            <IndexRoute component={Index} />
            <Route path="signIn" component={SignIn} />
        </Route>
    </Router>
), document.getElementById('app'));

p.S.当前我不在客户端上处理404,服务器为<my_domain>/signIn 返回404

您的服务器必须能够为任何需要"刷新"的URL呈现客户端应用程序。这就是浏览器的工作方式——访问URL会向该URL发送GET请求,服务器必须做出响应,客户端才能执行任何工作。