代码之家  ›  专栏  ›  技术社区  ›  hashbytes

React路由器v4,将未知路由重定向到主页/根页

  •  0
  • hashbytes  · 技术社区  · 7 年前

    有没有一种简单的方法可以将所有未知的路由重定向到主页?

    我使用的是嵌套管线结构,其中(嵌套)管线位于构件内部。

    1 回复  |  直到 7 年前
        1
  •  1
  •   Galupuf    7 年前

    React-Router: No Not Found Route?

    对于react路由器v4

    <Switch>
      <Route exact path="/" component={MyComponent} />
      <Route component={HomePage} />
    </Switch>