Next.js Discord

Discord Forum

How to fetch data on server side using graphql

Unanswered
Karelian Bear Dog posted this in #help-forum
Open in Discord
Karelian Bear DogOP
I am a bit confused can anyone tell me in Nextjs 15
1. if I use "use client" in my component then any component I use inside it do they automatically become client components
2. if anyone can tell how to fetch graphql data on server side

3 Replies

@Karelian Bear Dog I am a bit confused can anyone tell me in Nextjs 15 1. if I use "use client" in my component then any component I use inside it do they automatically become client components 2. if anyone can tell how to fetch graphql data on server side
if I use "use client" in my component then any component I use inside it do they automatically become client components
when your component "inside" is children then, no. If it's normally imported then, yes.

if anyone can tell how to fetch graphql data on server side
most graphql servers offer a api url that can be fetched. Put the requested schema inside the body with the variables as well and send the request to your graphql server. The response is now data that you can work with
@Karelian Bear Dog solved?
Karelian Bear DogOP
@B33fb0n3 the above issue is solved
but I have got another issue i.e the graphql caching with nextjs