We rely on Graphql-ppx for typesafe GraphQL operations and fragments in ReasonML. Go to the official documentation for installation instructions.
You should now have a
graphql_schema.json in your project somewhere. Make sure it's always up-to-date!
2. Apollo Client
Add the following under
graphql, in your
__typenamethroughout our operation and fragment definitions
"templateTag*"is how we tell
graphql-ppxto wrap every operation with
rescript-apollo-clientto automatically decorate the generated modules with Apollo-specific things like the correct hook for that operation!
If you use a bundler that does not support
require statements (eg:
esbuild), you will need to add one more piece of configuration