Commit 7fcd1ea7 authored by Arunoda Susiripala's avatar Arunoda Susiripala

Add async-reactor example.

parent 857a1d31
export default () => (
<p>Hello World 4 (imported dynamiclly) </p>
)
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
"start": "next start" "start": "next start"
}, },
"dependencies": { "dependencies": {
"async-reactor": "^1.1.1",
"next": "*", "next": "*",
"react": "^15.4.2", "react": "^15.4.2",
"react-dom": "^15.4.2" "react-dom": "^15.4.2"
......
...@@ -2,6 +2,7 @@ import React from 'react' ...@@ -2,6 +2,7 @@ import React from 'react'
import Header from '../components/Header' import Header from '../components/Header'
import Counter from '../components/Counter' import Counter from '../components/Counter'
import dynamic from 'next/dynamic' import dynamic from 'next/dynamic'
import { asyncReactor } from 'async-reactor'
const DynamicComponent = dynamic(import('../components/hello1')) const DynamicComponent = dynamic(import('../components/hello1'))
const DynamicComponentWithCustomLoading = dynamic( const DynamicComponentWithCustomLoading = dynamic(
...@@ -14,6 +15,10 @@ const DynamicComponentWithNoSSR = dynamic( ...@@ -14,6 +15,10 @@ const DynamicComponentWithNoSSR = dynamic(
import('../components/hello3'), import('../components/hello3'),
{ ssr: false } { ssr: false }
) )
const DynamicComponentWithAsyncReactor = asyncReactor(async () => {
const Hello4 = await import('../components/hello4')
return (<Hello4 />)
})
export default () => ( export default () => (
<div> <div>
...@@ -21,6 +26,7 @@ export default () => ( ...@@ -21,6 +26,7 @@ export default () => (
<DynamicComponent /> <DynamicComponent />
<DynamicComponentWithCustomLoading /> <DynamicComponentWithCustomLoading />
<DynamicComponentWithNoSSR /> <DynamicComponentWithNoSSR />
<DynamicComponentWithAsyncReactor />
<p>HOME PAGE is here!</p> <p>HOME PAGE is here!</p>
<Counter /> <Counter />
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment