I'm using Next.js and when I try to
import M from 'materialize-css';
I get this error:
window is undefined
You can only import the materialize-css on client side by using dynamic.
import dynamic from 'next/dynamic';
const M = dynamic(() => import('materialize-css'), {
ssr: false,
});