0
我試圖建立從「/賬戶」,以「/帳號/簽到」重定向從「/」的陣營,路由器
<Layout>
<Switch>
<Redirect from="/account" to="/account/signIn" />
<Route path="/account/signIn" component={() => <div>signIn</div>} />
<Route path="/account/signUp" component={() => <div>signUp</div>} />
</Switch>
</Layout>
重定向當我去http://localhost:3000/account/signUp我重定向到http://localhost:3000/account/signIn。 此問題已通過這種方式:
<Layout>
<Route exact path="/account" render={() => <Redirect to="/account/signIn" />} />
<Route path="/account/signIn" component={() => <div>signIn</div>} />
<Route path="/account/signUp" component={() => <div>signUp</div>} />
</Layout>
但我認爲這不是最好的辦法,因爲我有一個問題,這是bug還是正常的行爲?