diff --git a/examples/with-dynamic-import/components/hello3.js b/examples/with-dynamic-import/components/hello3.js new file mode 100644 index 00000000..809e3ddb --- /dev/null +++ b/examples/with-dynamic-import/components/hello3.js @@ -0,0 +1,3 @@ +export default () => ( +
Hello World 3 (imported dynamiclly)
+) diff --git a/examples/with-dynamic-import/pages/index.js b/examples/with-dynamic-import/pages/index.js index fa768c75..bf8dec9a 100644 --- a/examples/with-dynamic-import/pages/index.js +++ b/examples/with-dynamic-import/pages/index.js @@ -10,12 +10,17 @@ const DynamicComponentWithCustomLoading = dynamic( loading: () => (...
) } ) +const DynamicComponentWithNoSSR = dynamic( + import('../components/hello3'), + { ssr: false } +) export default () => (HOME PAGE is here!
loading...
) + this.ssr = options.ssr === false ? options.ssr : true + this.state = { AsyncComponent: null } this.isServer = typeof window === 'undefined' - this.loadComponent() + + if (this.ssr) { + this.loadComponent() + } } loadComponent () { @@ -27,6 +33,9 @@ export default function dynamicComponent (promise, options = {}) { componentDidMount () { this.mounted = true + if (!this.ssr) { + this.loadComponent() + } } render () {