Reactjs 使用react router v4注销并返回初始应用程序状态

Reactjs 使用react router v4注销并返回初始应用程序状态,reactjs,react-router,Reactjs,React Router,在浏览器中的第一个URL类型上,我的react应用程序与react router 4正常工作,它正在从/重定向到/fileupload我的代码示例: <div> <AuthButton /> <Redirect push path="/" to="/fileupload" /> <Route path="/login" render={(props) => <LogIn {...props} />} /> <Priv

在浏览器中的第一个URL类型上,我的react应用程序与react router 4正常工作,它正在从
/
重定向到
/fileupload
我的代码示例:

<div>
 <AuthButton />
 <Redirect push path="/" to="/fileupload" />
 <Route path="/login" render={(props) => <LogIn {...props} />} />
 <PrivateRoute path="/fileupload" user={FBAuth.currentUser} component={FileUploadForm} />
</div>
来自bellow的初始重定向

<Redirect push path="/" to="/fileupload" />
由于退出后我的
AuthButton
withRouter
包装,因此我的
LogIn
组件已加载,一切正常


但是我还是不知道重定向为什么不起作用。

为什么不直接按一下
/fileUpload
,用建议的方法它是可以的,而且它起作用了,但是
PrivateRoute
AuthButton
组件是通用的,如果我需要,我希望在我的应用程序中有多个
PrivateRoutes
不要找到解决方案,我会这样做的谢谢你,我真的很想了解发生了什么,为什么第二次重定向不起作用。。。
<Redirect push path="/" to="/fileupload" />
goToRoot = () => {
  this.props.history.replace(this.props.location.pathname);
 };