To use this template, add --template typescript-graphql
when creating a new app.
For example:
npx create-react-app my-app --template typescript-graphql
# or
yarn create react-app my-app --template typescript-graphql
- Put your queries/mutations in .graphql files anywhere in the src folder
- Edit the url in
codegen.yml
andsrc/index.tsx
if your graphql endpoint is nothttp://localhost:4000
- Generate hooks by running
yarn gen
ornpm run gen
- Use the generated hooks in your code
For more information, please refer to:
- Getting Started – How to create a new app.
- User Guide – How to develop apps bootstrapped with Create React App.