How to use ServerStyleSheet in Next.Js api route? #866 #68709
Unanswered
ako-v
asked this question in
App Router
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I need to render some data I get as an html and return it using an api route, I have something like below:
but when I try to call this api, I get this error:
createContext only works in Client Components. Add the "use client" directive at the top of the file to use it.I know this error happens because of ServerStyleSheet, my question is how can I use this ServerStyleSheet in the api route to be able to render data as an html? or if there is another way to render my data as an html in the server side, how can I do it?
Beta Was this translation helpful? Give feedback.
All reactions