mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Add an case to show when dynamic import components won't load.
This commit is contained in:
parent
aeaccf441b
commit
f8317f158b
3
examples/with-dynamic-import/components/hello5.js
Normal file
3
examples/with-dynamic-import/components/hello5.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export default () => (
|
||||||
|
<p>Hello World 5 (imported dynamiclly) </p>
|
||||||
|
)
|
|
@ -20,6 +20,8 @@ const DynamicComponentWithAsyncReactor = asyncReactor(async () => {
|
||||||
return (<Hello4 />)
|
return (<Hello4 />)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const DynamicComponent5 = dynamic(import('../components/hello5'))
|
||||||
|
|
||||||
export default () => (
|
export default () => (
|
||||||
<div>
|
<div>
|
||||||
<Header />
|
<Header />
|
||||||
|
@ -27,6 +29,14 @@ export default () => (
|
||||||
<DynamicComponentWithCustomLoading />
|
<DynamicComponentWithCustomLoading />
|
||||||
<DynamicComponentWithNoSSR />
|
<DynamicComponentWithNoSSR />
|
||||||
<DynamicComponentWithAsyncReactor />
|
<DynamicComponentWithAsyncReactor />
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Since DynamicComponent5 does not render in the client,
|
||||||
|
it won't get downloaded.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
{ React.noSuchField === true ? <DynamicComponent5 /> : null }
|
||||||
|
|
||||||
<p>HOME PAGE is here!</p>
|
<p>HOME PAGE is here!</p>
|
||||||
<Counter />
|
<Counter />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue