chakraui server/client sided rendering
Answered
Luan posted this in #help-forum
LuanOP
ChakraUI only works with client sided rendering.
is there a easier way to combine server- and clientsided rendering besides, exporting the component which uses clientsided rendering and importing the component to a serversided rendered page
is there a easier way to combine server- and clientsided rendering besides, exporting the component which uses clientsided rendering and importing the component to a serversided rendered page
15 Replies
that seems to be the only way (esp when you want metadata)
Answer
an alternative is make a file that exports things from the ui
and import if into the server comp
@riský that seems to be the only way (esp when you want metadata)
LuanOP
in nextjs 13 ther isnt really another way to add a title right?
depending on if the library is nice, they will add 'use client' to their exports, but idk
so my solution for this is create a client compoent that imports your ui components and then directly exports them
@riský https://nextjs-discord-common-questions.joulev.dev/how-to-set-metadata-to-page-tsx-rendered-as-client-components
LuanOP
gonna try that out give me a sec
i would advice against doing that unless you have to
like if user input needs to change the title
otherwise you should use server component
LuanOP
ah well fair enough, then ill leave it the way it already was ig
thank you tho
yeah and with you using nextjs router import, it also makes it a bit harder (you can create that in a diferent component tho)
but glad to try to assist you (and sorry for not a better solution)