-
In Next@12 I was able to import a Clientcomponent with dynamic import and set ssr to false. Then I was able to access for example the window object. In Next@13 I thought I would be able to access the window object in components who has the "use client" flag but I get an error that window is not defined. So I guess there is happening some serverside stuff because the window object is not defined. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
There's confusion about the client directive. It means that this component, also runs on the client. I've seen a lot of material out there which says only. Rather client components are like the components we wrote before. In order to send a full HTML frame from the server, client components run on the server too! This bit from the next.js docs:
I'll keep on investigating but for sure, unguarded DOM access in an SSR context still seems fishy. Edit notes
|
Beta Was this translation helpful? Give feedback.
-
I also not finding answer on this question. |
Beta Was this translation helpful? Give feedback.
There's confusion about the client directive. It means that this component, also runs on the client. I've seen a lot of material out there which says only. Rather client components are like the components we wrote before. In order to send a full HTML frame from the server, client components run on the server too!
This bit from the next.js docs:
I'll keep on investigating but for sure, unguarded DOM access in an SSR context still seems fishy.
Edit notes