forked from gregberge/loadable-components
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.js
More file actions
47 lines (42 loc) · 1.26 KB
/
App.js
File metadata and controls
47 lines (42 loc) · 1.26 KB
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
45
46
47
import React from 'react'
// eslint-disable-next-line import/no-extraneous-dependencies
import { reactLazy } from '@loadable/component'
import Html from './Html'
const A = reactLazy(() => import('./letters/A'))
const B = reactLazy(() => import('./letters/B'))
const C = reactLazy(() => import(/* webpackPreload: true */ './letters/C'))
const D = reactLazy(() => import(/* webpackPrefetch: true */ './letters/D'))
const E = reactLazy(() => import('./letters/E?param'), { ssr: false })
const X = reactLazy(props => import(`./letters/${props.letter}`))
const Sub = reactLazy(props => import(`./letters/${props.letter}/file`))
const RootSub = reactLazy(props => import(`./${props.letter}/file`))
const App = () => {
return (
<Html title="Hello">
<React.Suspense fallback="Loading">
<A />
<br />
<B />
<br />
<X letter="A" />
<br />
<X letter="F" />
<br />
<E />
<br />
<Sub letter="Z" />
<br />
<RootSub letter="Y" />
</React.Suspense>
</Html>
)
}
function Error({ error }) {
return (
<div>
<h1>Application Error</h1>
<pre style={{ whiteSpace: 'pre-wrap' }}>{error.stack}</pre>
</div>
);
}
export default App