0

Is there an easy way to redirect all unknown routes to home page?

I am using the nested route structure where (nested) routes lives inside the components.

hashbytes
  • 769
  • 1
  • 8
  • 26

1 Answers1

1

React-Router: No Not Found Route?

For react-router v4

<Switch>
  <Route exact path="/" component={MyComponent} />
  <Route component={HomePage} />
</Switch>
Galupuf
  • 2,827
  • 1
  • 12
  • 29
  • I am not using Switch, I am using the nested routes, where child routes will be in its parent component. – hashbytes Jan 10 '18 at 21:09