1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Use new import syntax in readme examples

This commit is contained in:
Tim Neutkens 2018-09-29 11:41:03 +02:00
parent 7f9d244d1f
commit 8fb6f7d5b6

View file

@ -916,7 +916,7 @@ Here are a few ways to use dynamic imports.
```jsx
import dynamic from 'next/dynamic'
const DynamicComponent = dynamic(import('../components/hello'))
const DynamicComponent = dynamic(() => import('../components/hello'))
export default () => (
<div>
@ -932,7 +932,7 @@ export default () => (
```jsx
import dynamic from 'next/dynamic'
const DynamicComponentWithCustomLoading = dynamic(import('../components/hello2'), {
const DynamicComponentWithCustomLoading = dynamic(() => import('../components/hello2'), {
loading: () => <p>...</p>
})
@ -950,7 +950,7 @@ export default () => (
```jsx
import dynamic from 'next/dynamic'
const DynamicComponentWithNoSSR = dynamic(import('../components/hello3'), {
const DynamicComponentWithNoSSR = dynamic(() => import('../components/hello3'), {
ssr: false
})
@ -971,8 +971,8 @@ import dynamic from 'next/dynamic'
const HelloBundle = dynamic({
modules: () => {
const components = {
Hello1: import('../components/hello1'),
Hello2: import('../components/hello2')
Hello1: () => import('../components/hello1'),
Hello2: () => import('../components/hello2')
}
return components