Skip to content

Example for useDialogLazy() #199

Description

@rovo89

The example is:

const MyDialog = () => import('./MyDialog');
const myDialog = useDialogLazy(MyDialog);

But I needed to add a .then((mod) => mod.default):

  const PDFViewerModal = () => import('@/components/pdf/PDFViewerModal').then((mod) => mod.default);
  const pdfModal = useDialogLazy(PDFViewerModal);

Did I miss some configuration/setup? Is this specific to Next.js 15.5 with AppRouter? The (AFAIK default) tsconfig.json is:

{
  "compilerOptions": {
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "target": "ES6",
    "plugins": [
      {
        "name": "next"
      }
    ],
    "paths": {
      "@/*": ["./src/*"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules"]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions