Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Aug 13, 2021
1 parent cbd87a8 commit 9ff8f57
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion docs/advanced-features/dynamic-import.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,21 @@ function Home() {
export default Home
```

If you set option `suspense` to true, both option `ssr` and `loading` will be omitted, delegating rendering control to React `<Suspense />`.
If you set option `suspense` to true, other options will be omitted, delegating rendering control to React `<Suspense />`.
It's similar to using `React.lazy` directly, but `next/dynamic` will support mode like CSR and SSG.

To use `suspense`, you need to enable `reactRoot` and `concurrentFeatures` in `next.config.js`.

Note: `reactRoot` will be enabled by default when using React 18.

```jsx
// next.config.js
module.exports = {
experimental: {
reactRoot: true,
concurrentFeatures: true,
},
}
```

If you only enable `reactRoot` but not `concurrentFeatures`, suspense will always render fallbacks on server side.

0 comments on commit 9ff8f57

Please sign in to comment.