Working with React Server Components (RSC) #9481
Unanswered
pepew-le-boss
asked this question in
Q&A
Replies: 2 comments
-
I am not sure if there is anything special we need. Codegen is merely for type generation. if you wan to use with |
Beta Was this translation helpful? Give feedback.
0 replies
-
For anyone facing the same problem here's what I did. Client component: const { data: response } = useQuery({
queryKey: ["myQueryKey"],
queryFn: () => graphqlRequest({ document: myTypedGraphqlQuery, variables: { someVariable: "foo" }}),
}) Server component: const response = await graphqlRequest({
document: myTypedGraphqlQuery,
variables: { someVariable: "foo" },
}) The function |
Beta Was this translation helpful? Give feedback.
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on a brand new NextJS 13 project. My plan is to use the fetch() API for RSC and apollo-client for Client Components.
I also have a GraphQL server. I want to have some sort of type safety using GraphQL, that's why I came accross graphql-code-generator.
I found some good documentation on how to use it with apollo-client.
My problem is that I didn't found anything about graphql-codegen with RSC and more specifically the fetch() API.
Maybe I missed something, I don't know.
Beta Was this translation helpful? Give feedback.
All reactions