Can a GraphQL API be consumed from a server component?
Answered
Brown bear posted this in #help-forum
Brown bearOP
I understand that Apollo Client has Hooks but Hooks can only be used inside a client component.
Answered by joulev
you can simply not use apollo hooks: https://www.apollographql.com/blog/how-to-use-apollo-client-with-next-js-13
though in server components i prefer something more simple – https://github.com/jasonkuhrt/graphql-request
though in server components i prefer something more simple – https://github.com/jasonkuhrt/graphql-request
2 Replies
@Brown bear I understand that Apollo Client has Hooks but Hooks can only be used inside a client component.
you can simply not use apollo hooks: https://www.apollographql.com/blog/how-to-use-apollo-client-with-next-js-13
though in server components i prefer something more simple – https://github.com/jasonkuhrt/graphql-request
though in server components i prefer something more simple – https://github.com/jasonkuhrt/graphql-request
Answer