import { lazy } from 'react';
const NewPage = lazy(() => import('src/pages/NewPage'));
export default function Router() {
return useRoutes([
{
element: (
<MainLayout>
<Outlet />
</MainLayout>
),
children: [
{ path: <HomePage />, index: true }, // => '/'
{ path: 'new-page', element: <NewPage /> }, // => '/new-page'
{
path: 'pages',
children: [
{ element: <Pages />, index: true }, // => '/pages'
{ path: 'color', element: <ColorPage /> }, // => '/pages/color'
],
},
],
},
{
element: (
<DashboardLayout>
<Outlet />
</DashboardLayout>
),
children: [
{ path: <DashboardPage />, index: true }, // => '/dashboard'
{ path: 'new', element: <DashboardNewPage /> }, // => '/dashboard/new'
{
path: 'user',
children: [
{ element: <UserPage />, index: true }, // => '/dashboard/user'
{ path: 'list', element: <UserListPage /> }, // => '/dashboard/user/list'
{ path: 'edit', element: <UserEditPage /> }, // => '/dashboard/user/edit'
],
},
],
},
]);
}