Material-table: window is defined in next.js

Created on 10 Jul 2020  路  4Comments  路  Source: mbrn/material-table

I am getting error widow not defined in next.js after updating to v1.64.0, its because of jspdf You have used

bug

Most helpful comment

Temporary fix is to use nextjs dynamic import:
```js
import dynamic from "next/dynamic";

const MaterialTable = dynamic(() => import("material-table"), { ssr: false });

All 4 comments

I have same problem when using Next JS.

This is related to #2112 and there is a pull request open already, in case you want to pluck the fix for yourself #2114 . The problem is withing jsPDF and the trick is to only import it if there is a window defined (which is not the case during server side render)

Closing in favor of #2112

Temporary fix is to use nextjs dynamic import:
```js
import dynamic from "next/dynamic";

const MaterialTable = dynamic(() => import("material-table"), { ssr: false });

Was this page helpful?
0 / 5 - 0 ratings