EN
React / react-router - route respond to multiple paths
0
points
In this article, we would like to show you how to set Route to respond to more than one paths in react-router.
Quick solution:
<Route path="/(path1|path2)/" component={component} />
Practical example:
import { Route } from 'react-router-dom';
const App = () => {
// Some code...
<Route path='/(home|faq)/' component={Home} />;
};
Home component is rendered for the '/home' and '/faq' paths.