我有一个简单的网络应用程序与创建反应,应用程序和表达。反应路由器不能GET /路由后才部署到Heroku
使用反应路由器制作的所有页面都可以在本地正常工作,以及在我自己的机器上在线一旦部署到Heroku。
但是,在其他机器在线测试后,我无法访问这些页面 - 每当我点击他们来说,这显示Cannot GET /*route*
我仍然有*名称的链接* .herokuapp.com域如果影响以任何方式
我使用重定向代码如下:(我用的火力和反应,引导和)
class App extends Component {
render() {
return (
<div>
<MyNavbar/>
<Switch>
<Route exact path="/" component={Home}/>
<Route exact path="/eateries" component={Eateries}/>
<Route exact path="/thank-you" component={ThankYou}/>
</Switch>
</div>
);
}
重定向到/感谢信:
componentWillMount() {
firebase.auth().onAuthStateChanged((user) => {
if (user) {
window.location = "thank-you"
}
})
}
所以基本上,当通过一个模式组件在用户的迹象,应该带他们去/感谢信
重定向到/餐馆:
<NavItem href="/eateries">
For Eateries
</NavItem>
是不是有什么毛病我的方式m重定向用户还是一般使用反应路由器?
很难说没有更多的信息,但'window.location'应链接到'/ thank-you' –
你需要什么信息? – VWang