Is useState available on SSR?
Answered
Rose-breasted Grosbeak posted this in #help-forum
Rose-breasted GrosbeakOP
Google Bard told me that I can use useState on SSR. I asked for related official documents, and all of them are 'invalid URL deleted'. Google Bard must have misinformed me, right?
+ To be exact, it told me one hook. They told me that I need to install one official package of next.js to use it. I was going to install it, but I think it was a non-existent package.
+ To be exact, it told me one hook. They told me that I need to install one official package of next.js to use it. I was going to install it, but I think it was a non-existent package.
Answered by riský
you can use useState in ssr as long as the component is client (ie
'use client' at top)5 Replies
@Rose-breasted Grosbeak Google Bard told me that I can use useState on SSR. I asked for related official documents, and all of them are 'invalid URL deleted'. Google Bard must have misinformed me, right?
+ To be exact, it told me one hook. They told me that I need to install one official package of next.js to use it. I was going to install it, but I think it was a non-existent package.
you can use useState in ssr as long as the component is client (ie
'use client' at top)Answer
@riský you can use useState in ssr as long as the component is client (ie `'use client'` at top)
Rose-breasted GrosbeakOP
I just asked Bard again, and he said he can use it without writing down 'use client'.
bard is wrong then
@riský bard is wrong then
Rose-breasted GrosbeakOP
I see, and thank you for your response!
@Rose-breasted Grosbeak I see, and thank you for your response!
No problem, happy to help 😄