react router dom v5版本嵌套路由重定向失败?

新手上路,请多包涵

通过最外层路由配置文件匹配路由 /auth-apply 进入这个页面(路由 /auth-apply的配置中未加 exact),然后需要重定向到/auth-apply/add-info 这个子路由,下面这种代码编写运行的情况是能正常进入这个页面,重定向的时候地址栏中的路径是变成了 /auth-apply/add-info ,但就是对应的 AuthForm 组件的内容没有渲染出来,GlobalLayout中是一片空白,这是什么原因?麻烦大佬指点一下。多谢🙏🏻
render() {

return (
  <div className={styles.AuthApply}>
    <GlobalLayout history={this.props.history}>
      <Switch>
        <Route exact path="/auth-apply/add-info">
          <AuthForm {...this.props} />
        </Route>
        <Route path="/auth-apply/result">
          <AuthResult {...this.props} />
        </Route>
        <Route
          path="/auth-apply"
          render={() => <Redirect to="/auth-apply/add-info" push />}
        />
      </Switch>
    </GlobalLayout>
  </div>
);

}

阅读 815
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题