Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用react-router-component(不是 react-router)来处理我的单页应用程序中的路由。刷新页面或在地址栏中手动输入路由会导致找不到页面。如何处理 react-router-component 中的地址刷新和导航?
默认情况下,服务器将在它接收到的路由中查找 html 文件。因此,您应该将其配置为 html5 导航,以便为它接收到的任何路线返回 index.html。
例如使用 webpack-dev-server,你可以将它添加到你的 webpack 开发服务器配置中:
historyApiFallback: true