react router multiple path code example
Example 1: react router multiple path
<Router>
<Route path={["/home", "/users", "/widgets"]} component={Home} />
</Router>
Example 2: multiple path names for a same component in react router
<Router>
<Route path={["/home", "/users", "/widgets"]} component={Home} />
</Router>
Example 3: multiple path names for a same component in react router
<Router>
{["/home", "/users", "/widgets"].map((path, index) =>
<Route path={path} component={Home} key={index} />
)}
</Router>
Example 4: multiple path names for a same component in react router
<Route path={"/home" | "/users" | "/widgets"} component={Home} />