-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathroutes.ts
37 lines (32 loc) · 968 Bytes
/
routes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { lazy, LazyExoticComponent } from 'react';
// import { LazyPage1, LazyPage2, LazyPage3 } from '../01-lazyload/pages';
type JSXComponent = () => JSX.Element;
interface Route {
to: string;
path: string;
Component: LazyExoticComponent<JSXComponent> | JSXComponent;
name: string;
}
const Lazy1 = lazy(() => import(/* webpackChunkName: "LazyPage1" */'../01-lazyload/pages/LazyPage1'));
const Lazy2 = lazy(() => import(/* webpackChunkName: "LazyPage2" */'../01-lazyload/pages/LazyPage2'));
const Lazy3 = lazy(() => import(/* webpackChunkName: "LazyPage3" */'../01-lazyload/pages/LazyPage3'));
export const routes: Route[] = [
{
to: 'lazy1',
path: 'lazy1',
Component: Lazy1,
name: 'Lazy-1'
},
{
to: 'lazy2',
path: 'lazy2',
Component: Lazy2,
name: 'Lazy-2'
},
{
to: 'lazy3',
path: 'lazy3',
Component: Lazy3,
name: 'Lazy-3'
}
];