why render twice with “use clientâ€
Unanswered
Asiatic Lion posted this in #help-forum
Asiatic LionOP
Hello ,here is the code
"use client";
export default function Home() {
return <p>{Math.random()}</p>;
}
Code like this get alway errors ,some component need be rendered only on client but with “use client†I can’t avoid the errors
"use client";
export default function Home() {
return <p>{Math.random()}</p>;
}
Code like this get alway errors ,some component need be rendered only on client but with “use client†I can’t avoid the errors
6 Replies
client components are still pre-rendered on the server, the directive doesn't mean they only render in the client
if you want to disable SSR you can use
next/dynamic: https://nextjs.org/docs/app/building-your-application/optimizing/lazy-loading#skipping-ssr@Rafael Almeida if you want to disable SSR you can use `next/dynamic`: <https://nextjs.org/docs/app/building-your-application/optimizing/lazy-loading#skipping-ssr>
Asiatic LionOP
thank you for your help , normally what we do?we keep errors or need to disable SSR,I'm newbie I can't understand what it make sense render both on server and client, I have a page who need login to display so get alway errors and errors
if you disable SSR your page will have a flash of content (or with a loading component) so you should always avoid it unless you are sure you need it
its better to understand why you are receiving an error and try to fix it instead
@Rafael Almeida if you disable SSR your page will have a flash of content (or with a loading component) so you should always avoid it unless you are sure you need it
Asiatic LionOP
I use PocketBase js sdk to login,client side is logged in successfully but not in server side