rsnext/errors/invalid-dynamic-options-type.mdx
Delba de Oliveira 44d1a1cb15
docs: Migrate error messages to MDX and App Router. (#52038)
This PR is part of a larger effort to migrate error messages to MDX and
use App Router: https://github.com/vercel/front/pull/23459
2023-07-05 06:11:16 -07:00

33 lines
736 B
Text

---
title: 'Invalid options type in a `next/dynamic` call'
---
## Why This Error Occurred
You have an invalid options type in a `next/dynamic` call. The options must be an object literal.
## Possible Ways to Fix It
**Before**
```jsx filename="example.js"
import dynamic from 'next/dynamic'
const options = { loading: () => <p>...</p>, ssr: false }
const DynamicComponent = dynamic(() => import('../components/hello'), options)
```
**After**
```jsx filename="example.js"
import dynamic from 'next/dynamic'
const DynamicComponent = dynamic(() => import('../components/hello'), {
loading: () => <p>...</p>,
ssr: false,
})
```
## Useful Links
- [Dynamic Import](/docs/pages/building-your-application/optimizing/lazy-loading)