Next.js Discord

Discord Forum

Window not defined error

Answered
Yacare Caiman posted this in #help-forum
Open in Discord
Yacare CaimanOP
Getting this error while build on page where i'm using 'use client' so technically shouldn't it stop it from prerendering it and render it at client side?

7 Replies

Yacare CaimanOP
Error occurred prerendering page "/create". Read more: https://nextjs.org/docs/messages/prerender-error ReferenceError: window is not defined
Answer
Yacare CaimanOP
thx it worked🫶
Yacare CaimanOP
Hey but the deployContract isn't a react function! So it isnt working as intended
@joulev https://nextjs-faq.com/browser-api-client-component
i don't do web3, i don't know about the specifics of your code, but this is the cause for that
client components are prerendered on the server