Spaces:
Sleeping
Sleeping
File size: 642 Bytes
15975c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import { Navigate, Route, Routes } from "react-router-dom";
import { routerType } from "../types/router.types";
import pagesData from "./pagesData";
import MainLayout from "./Layout/MainLayout";
const Router = () => {
const pageRoutes = pagesData.map(({ path, title, element }: routerType) => {
return <Route key={title} path={`/${path}`} element={element} />;
});
return (
<Routes>
<Route element={<MainLayout />} path="/">
<Route index element={<Navigate to="/Home" replace />} />
{pageRoutes}
</Route>
</Routes>
);
};
export default Router; |