Answers for "how to add same component for two routes in react router dom"

1

multiple path names for a same component in react router

<Router>
    <Route path={["/home", "/users", "/widgets"]} component={Home} />
</Router>
Posted by: Guest on June-06-2020
0

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>
Posted by: Guest on June-06-2020

Code answers related to "how to add same component for two routes in react router dom"

Browse Popular Code Answers by Language