Skip to main content
@superdoc-dev/react includes full TypeScript support.

TypeScript usage

Exported types

Framework integration

Next.js (App Router)

The wrapper handles SSR automatically. For additional control, use dynamic with ssr: false:

Next.js (Pages Router)

Vite / Create React App

Works out of the box:

Troubleshooting

”document is not defined” (SSR)

The component handles SSR internally, but if you still see errors, use dynamic import:

React Strict Mode double-mount

The component handles React 18 Strict Mode correctly. The internal cleanup flag prevents issues from double-invocation during development.

Document not loading

  1. Verify the file is a valid .docx document
  2. Check that document prop is a File, Blob, URL string, or config object
  3. Listen for onContentError events for parsing errors

Changing document mode

The component handles documentMode prop changes efficiently without rebuilding:
You can also use the imperative API: