Next.js Discord

Discord Forum

Is Next.js a Good Fit for GraphQL?

Unanswered
Fire ant posted this in #help-forum
Open in Discord
Fire antOP
We chose Next.js because we wanted to take advantage of SSR (Server-Side Rendering).
However, our backend uses GraphQL, and on the client side, we fetch data using Apollo’s useQuery.
The issue is that useQuery only works on the client, which makes it difficult to fully leverage SSR with Next.js.
So now we’re wondering — is Next.js simply not a good fit for GraphQL?

1 Reply

@Fire ant We chose Next.js because we wanted to take advantage of SSR (Server-Side Rendering). However, our backend uses GraphQL, and on the client side, we fetch data using Apollo’s useQuery. The issue is that useQuery only works on the client, which makes it difficult to fully leverage SSR with Next.js. So now we’re wondering — is Next.js simply not a good fit for GraphQL?
you don't have to use apollo on the client. you can fetch on the server as well, there are plenty of articles and examples on the apollo website on how to do that

that said, since if you fetch on the server you don't need to bother with any state management or anything, i'd just use something lightweight like https://www.npmjs.com/package/graphql-request