{
path: '/searchCars/*',
Element: <SearchCars />,
visible: true,
children: [
{
path: 'Cars/*',
Element: <'Cars />,
visible: true,
},
{
path: 'Cars/:id',
Element: <CarsId />,
visible: true,
},
]
},
{
path: '/about',
Element: <About' />,
visible: true
}
const AppRouter = () => {
const recursy = (item) => {
if(item.children){
return <Route path={item.path} element={item.Element}>
{item.children.map(recursy)}
</Route>;
}
return <Route path={item.path} element={item.Element} />;
};
return (
<Routes>
<Route path={LOYOUT} element={<Loyout />}>
{privateLoyoutRoutes.map(recursy)}
</Route>
<Route path={NOTFOUND} element={<NotFound />} />
</Routes>
);
};
export default AppRouter;
{
path: '/',
Element: Main,
visible: true
},