Modal 3.7.x break in Next.js
See original GitHub issueDescription
Since Next.js is SSR, it will not recognize the document
Need to modify this line 34 on Modal.js
var MODAL_CONTAINER = document.body;
into
var MODAL_CONTAINER = (typeof window !== 'undefined') ? document.body : null;
I know, the modal might not work in Next.js anyway, but I still can use the rest of components in react-materialize without breaking.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Modal component with Next.js - Dev Recipes
In this tutorial, I will show you how to create a basic Modal component from scratch in a Next.js application.
Read more >Release Notes - The PHP Framework For Web Artisans
Minor and patch releases should never contain breaking changes. When referencing the Laravel framework or its components from your application or package, you ......
Read more >Components - Bootstrap
Over a dozen reusable components built to provide iconography, dropdowns, input groups, navigation, alerts, and much more.
Read more >Modal component is not showing up in Next.JS - Stack Overflow
I'm using Tailwind CSS in my project and the table page is part of bigger page that contains a sidebar. You can find...
Read more >Changelog - Cypress Documentation
Component Testing is now generally available for projects using React, Next.js, Angular, and Vue! Component tests allow you to see and test your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

To avoid broken on the first run (while loading on NextJS) …
I change Modal.js at line 197 (compiled version line 225)
into
and it’s working ok. I think It’s also should be ok for regular react anyway.
I still can use the Modal, using Non-SSR technique when I use it on NextJS.
as reference on NextJS: https://github.com/zeit/next.js/issues/7400
ouch, fixed in next patch version