Is there a way to make a route the default route without using "/"? I want the route below to be the route users see when they open my page, but I don't want to change the path name.
<Route path="/about" element={<About />}></Route>
Is there a way to make a route the default route without using "/"? I want the route below to be the route users see when they open my page, but I don't want to change the path name.
<Route path="/about" element={<About />}></Route>
With a Redirect. If you are using react-router-dom@5
(or below), you can use a Redirect
component.
In your Route manager:
<Route exact path="/">
<Redirect to="/about" />
</Route>
Otherwise, when using react-router-dom@6
, please refer to this question.