-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.jsx
44 lines (40 loc) · 1.2 KB
/
App.jsx
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
38
39
40
41
42
43
44
import { lazy, Suspense } from 'react'
import { createBrowserRouter } from 'react-router'
import { RouterProvider } from 'react-router/dom'
import { About } from '~/client/components/About'
import { Footer } from '~/client/components/Footer'
import { Home } from '~/client/components/Home'
import { Loading } from '~/client/components/Loading'
import { Navbar } from '~/client/components/Navbar'
const Articles = lazy(() =>
import('~/client/components/Articles').then(module => ({
default: module.Articles,
}))
)
const Contact = lazy(() =>
import('~/client/components/Contact').then(module => ({
default: module.Contact,
}))
)
const Work = lazy(() =>
import('~/client/components/Work').then(module => ({ default: module.Work }))
)
const router = createBrowserRouter([
{
path: '/',
element: <Navbar />,
children: [
{ path: '/', element: <Home /> },
{ path: '/about', element: <About /> },
{ path: '/work', element: <Work /> },
{ path: '/articles', element: <Articles /> },
{ path: '/contact', element: <Contact /> },
],
},
])
export const App = () => (
<Suspense fallback={<Loading />}>
<RouterProvider router={router} />
<Footer />
</Suspense>
)