Is it possible to call a mutation inside of a Next.js server component?
I want to mutate data on our GraphQL backend but the component I'm in is a server component inside of a server component and I can't change it to a client component because you can't have client stuff inside server stuff.
Is it possible to run a mutation inside of a server component? For queries, I use
queryClient.fetchQuery
but there doesn't appear to be a similar method on queryClient
.3 Replies
sunny-green•2y ago
Just call the mutationFn directly?
robust-apricotOP•2y ago
dont you have to call
useWhateverMutation
or useMutation
to get the mutationFn
though? If I do that, I get an error:
sunny-green•2y ago
Yeah. Call your definition of mutationFn