Llabe
Llabe12mo ago

Server fetchQuery and fetchMutation

Hey, when using the identity to auth queries and mutation, those queries and mutations must be done in client components always, not in rsc or server actions, right? Or I am mistaken
2 Replies
TwendyKirn
TwendyKirn12mo ago
Hey, if you are using nextjs you can also call queries and mutations on the server side. For that use preloadQuery (in order to have real time) or fetchQuery/fetchMutation (will be without real time). For Auth you need to send your Auth token inside query params. Docs and examples - https://docs.convex.dev/client/react/nextjs/server-rendering
Next.js Server Rendering | Convex Developer Hub
Next.js automatically renders both Client and Server Components on the server
Llabe
LlabeOP12mo ago
Ooh okey, it makes sense Thansk a lot

Did you find this page helpful?