0
我使用反應路由器V4如何重定向到另一個路由器時VIST「/」
下面是我的代碼
<Provider store={store}>
<ConnectedRouter history={history}>
<div> { /* your usual react-router v4 routing */ }
<Switch>
<Route path="/register" component={Register} />
<Route path="/login" component={Login} />
<Route path="/main" component={App} />
</Switch>
</div>
</ConnectedRouter>
</Provider>
如何設置/註冊路由器的缺省路由,或者當用戶訪問「 /「它會重定向到/註冊?
我記得React路由器有一個叫做IndexRoute的特徵,它能解決你的問題嗎? – thelonglqd