Steps to use graphql endpoint on react client
Hello, this might be a very beginner question. I have a Graphql endpoint and I want to use that in a react client with full type-safety. Could someone let me know what are the steps or how you would approach this? I'm wondering whats the right way to get the schema to code generation with hooks. I have some idea in terms of what I need, but I couldn't find any good resources on setting up and using an external datasource for a production app. Any help is appreciated. Thanks everyone.
Note: I don't mind using URQL or apollo react client or react-query
2 Replies
I tried this just this morning!
Graphql codegen seems very easy to setup with either apollo or urql
GraphQL-Codegen
Introduction (GraphQL-Codegen)
GraphQL Code Generator is a plugin-based tool that helps you get the best out of your GraphQL stack. From back-end to front-end, GraphQL Code Generator automates the generation of typed Queries, Mutations and, Subscriptions for React, Vue, Angular, Next.js, Svelte, whether you are using Apollo Client, URQL or, React Query.