Next.js Discord

Discord Forum

Facing issue while deploying to vercel of window not defined

Answered
Basset Bleu de Gascogne posted this in #help-forum
Open in Discord
Basset Bleu de GascogneOP
I am facing issues while deploy to vercel , even tho I have mentioned the component as client side I am still getting the issue https://gist.github.com/kaushikc44/eecea441aa619b8dc1d308c22c98935e this is the link for the code
Answered by Clown
I think the issue is that you are trying to use window outside of a useEffect/before the component is mounted.
View full answer

10 Replies

Basset Bleu de GascogneOP
code link
I think the issue is that you are trying to use window outside of a useEffect/before the component is mounted.
Answer
Maybe that console.log is doing that
@Clown I think the issue is that you are trying to use `window` outside of a useEffect/before the component is mounted.
Basset Bleu de GascogneOP
so I am suppose to use it with the useEffect
I might have to change the code thne
Also you can do

npm run build && npm start
To test it out locally
Basset Bleu de GascogneOP
cool thanks alot
@Basset Bleu de Gascogne thanks alot it worked !
Mark the answer please :sunglasses_1: