2017-04-17 15:33:40 +00:00
|
|
|
import React from 'react'
|
|
|
|
import Header from '../components/Header'
|
|
|
|
import Counter from '../components/Counter'
|
2017-04-17 20:15:50 +00:00
|
|
|
import dynamic from 'next/dynamic'
|
2017-04-27 15:22:25 +00:00
|
|
|
import { asyncReactor } from 'async-reactor'
|
2017-04-17 15:33:40 +00:00
|
|
|
|
2017-04-18 16:37:57 +00:00
|
|
|
const DynamicComponent = dynamic(import('../components/hello1'))
|
|
|
|
const DynamicComponentWithCustomLoading = dynamic(
|
|
|
|
import('../components/hello2'),
|
|
|
|
{
|
|
|
|
loading: () => (<p>...</p>)
|
|
|
|
}
|
|
|
|
)
|
2017-04-18 16:51:31 +00:00
|
|
|
const DynamicComponentWithNoSSR = dynamic(
|
|
|
|
import('../components/hello3'),
|
|
|
|
{ ssr: false }
|
|
|
|
)
|
2017-04-27 15:22:25 +00:00
|
|
|
const DynamicComponentWithAsyncReactor = asyncReactor(async () => {
|
|
|
|
const Hello4 = await import('../components/hello4')
|
|
|
|
return (<Hello4 />)
|
|
|
|
})
|
2017-04-17 15:33:40 +00:00
|
|
|
|
|
|
|
export default () => (
|
|
|
|
<div>
|
|
|
|
<Header />
|
|
|
|
<DynamicComponent />
|
2017-04-18 16:37:57 +00:00
|
|
|
<DynamicComponentWithCustomLoading />
|
2017-04-18 16:51:31 +00:00
|
|
|
<DynamicComponentWithNoSSR />
|
2017-04-27 15:22:25 +00:00
|
|
|
<DynamicComponentWithAsyncReactor />
|
2017-04-17 15:33:40 +00:00
|
|
|
<p>HOME PAGE is here!</p>
|
|
|
|
<Counter />
|
|
|
|
</div>
|
|
|
|
)
|