Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
7fcd1ea7
Commit
7fcd1ea7
authored
Apr 27, 2017
by
Arunoda Susiripala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add async-reactor example.
parent
857a1d31
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
hello4.js
examples/with-dynamic-import/components/hello4.js
+3
-0
package.json
examples/with-dynamic-import/package.json
+1
-0
index.js
examples/with-dynamic-import/pages/index.js
+6
-0
No files found.
examples/with-dynamic-import/components/hello4.js
0 → 100644
View file @
7fcd1ea7
export
default
()
=>
(
<
p
>
Hello
World
4
(
imported
dynamiclly
)
<
/p
>
)
examples/with-dynamic-import/package.json
View file @
7fcd1ea7
...
@@ -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"
...
...
examples/with-dynamic-import/pages/index.js
View file @
7fcd1ea7
...
@@ -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
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment