Next.js Discord

Discord Forum

Using "use client" in my header component causes webpage to become unresponsive.

Answered
Cuban Crocodile posted this in #help-forum
Open in Discord
Cuban CrocodileOP
I need to use the useState function for my header to create a menu function for the navbar. However, whenever i add "use client" to the top of my code, everything stops working on the webpage, the webpage then goes blank, refreshing just makes it infinitely load, and nothing works unless I remove "use client" and then reopen localhost in a new tab. One of my tabs wouldn't even close anymore and was just stuck loading.

Mac OS, Next.js v13.4.7, Node v18.5

Here is code in reference:
Answered by joulev
Client components cannot be async
View full answer

7 Replies

Answer
Cuban CrocodileOP
ooh
thank you so much
do you mind explaining that though
Basically async client components will cause an infinite loop of renderings
That’s why everything hangs
Cuban CrocodileOP
somehow I knew there was an infinite loop, but I didn't get where, but now that makes so much more sense. Thank you so much man