Reputation: 5123
<Route exact path={"/" || "/home"}>
<Home />
</Route>
How can I achieve something like this without having to write another Route just for home?
Upvotes: 1
Views: 40
Reputation: 203457
Use an array of path strings. Remember that path order and specificity typically matter, so list the more specific paths before the less specific paths. If you still need to disambiguate the paths, then add the exact
prop.
<Route path={["/home", "/"]}>
<Home />
</Route>
Upvotes: 1