<Router>
<Route path={["/home", "/users", "/widgets"]} component={Home} />
</Router>
import { Outlet } from 'react-router-dom';
const AppLayout = () => (
<>
<NavBar />
<SideBar />
<main className={styles["main--container"]}>
<div className={styles["main--content"]}>
<Outlet /> // <-- nested routes rendered here
</div>
</main>
</>
);
const App = () => {
return (
<>
<Routes>
<Route path="/login" element={<LoginPage />} />
<Route element={<AppLayout />} >
<Route path="/" element={<Dashboard />} /> // <-- nested routes
</Route>
</Routes>
</>
);
};
//use multiple components in one Route:
<Route path='/path' render={props =>
<div>
<FirstChild />
<SecondChild />
</div>
} />
<Routes>
<Route
path="/"
element={[
<Header key={1} />,
<LandingSection key={2} />,
<CardList key={3} /> ]}>
</Route>
</Routes>