/
lizardking
/
react_project
Обзор
Документация
Войти
/
lizardking
/
react_project
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
react19
src/app/router.tsx
75 строк
2 KB
LizardKing
Task 9 - React 19
14 ноя 2025, 20:35
14 ноя 2025, 20:35
86e4531
Код
Авторство
О чём код?
import { RequireAuth } from 'features/auth' import { createBrowserRouter, type RouteObject } from 'react-router-dom' import { Layout } from './Layout' const routes: RouteObject[] = [ { element: <Layout />, children: [ { path: '/', async lazy() { const { HomePage } = await import('pages/home') return { Component: HomePage } }, }, { path: '/portal', async lazy() { const { PortalPage } = await import('pages/portal') return { Component: PortalPage } }, }, { path: '/react19', async lazy() { const { React19Page } = await import('pages/react19') return { Component: React19Page } }, }, { path: '/register', async lazy() { const { RegisterPage } = await import('pages/register') return { Component: RegisterPage } }, }, { path: '/login', async lazy() { const { LoginPage } = await import('pages/login') return { Component: LoginPage } }, }, { element: <RequireAuth />, children: [ { path: '/profile', async lazy() { const { ProfilePage } = await import('pages/profile') return { Component: ProfilePage } }, }, { path: '/ref', async lazy() { const { RefExamplePage } = await import('pages/refExample') return { Component: RefExamplePage } }, }, { path: '/tasks', async lazy() { const { TaskPage } = await import('pages/task') return { Component: TaskPage } }, }, ], }, ], }, ] export const router = createBrowserRouter(routes)