I encounter a "ReferenceError: document is not defined" error when using "page routes" in Next.js. #439
Unanswered
geunheejung
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am currently using Next.js 14 and developing with the "page route" method. The error mentioned above occurs when building the project. I believe this is happening due to server-side rendering, is that correct? For now, I resolved it by adding a check to ensure the Map component is only evaluated during client-side rendering using const [isClient, setIsClient] = useState(false);. Is there any other recommended method from the library for handling server-side rendering issues?
Beta Was this translation helpful? Give feedback.
All reactions