Back to Graphql Code Generator

typescript-urql

website/src/pages/plugins/typescript/typescript-urql.mdx

1.17.7915 B
Original Source

import { Callout } from '@theguild/components' import { PluginApiDocs, PluginHeader } from '@/components/plugin' import { pluginGetStaticProps } from '@/lib/plugin-get-static-props' export const getStaticProps = pluginGetStaticProps(__filename, { hasOperationsNote: true })

<Callout type="info">

We now recommend using the client-preset package for a better developer experience and smaller impact on bundle size.

Get started on our "React/Vue" guide.

</Callout> <PluginHeader /> <PluginApiDocs />

Usage Example

For the given input:

graphql
query Test {
  feed {
    id
    commentCount
    repository {
      full_name
      html_url
      owner {
        avatar_url
      }
    }
  }
}

We can use the generated code like this:

tsx
<TestComponent variables={...}>
  …
</TestComponent>

Or if you prefer:

ts
const [result] = useTestQuery(...)