How to use the graphql-hooks.GraphQLClient function in graphql-hooks

To help you get started, weโ€™ve selected a few graphql-hooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ShadOoW / web-starter-kit / src / lib / init-graphql.js View on Github external
function create(initialState = {}) {
  return new GraphQLClient({
    ssrMode: isServer,
    url: 'https://rickandmortyapi.com/graphql',
    cache: memCache({ initialState }),
    fetch: typeof window !== 'undefined' ? fetch.bind() : unfetch, // eslint-disable-line
  });
}
github zeit / next.js / examples / with-graphql-hooks / lib / init-graphql.js View on Github external
function create(initialState = {}) {
  return new GraphQLClient({
    ssrMode: typeof window === 'undefined',
    url: 'https://api.graph.cool/simple/v1/cixmkt2ul01q00122mksg82pn',
    cache: memCache({ initialState }),
    fetch: typeof window !== 'undefined' ? fetch.bind() : unfetch, // eslint-disable-line
  })
}
github datenguide / datenguide / src / lib / graphql-init.js View on Github external
function create(initialState = {}) {
  return new GraphQLClient({
    ssrMode: typeof window === 'undefined',
    url: process.env.DATENGUIDE_API,
    cache: memCache({ initialState }),
    fetch: typeof window !== 'undefined' ? fetch.bind() : unfetch // eslint-disable-line
  })
}
github nearform / graphql-hooks / examples / typescript / src / App.tsx View on Github external
import {
  GraphQLClient,
  ClientContext,
  useQuery,
  useMutation,
  useManualQuery,
  APIError
} from 'graphql-hooks'

interface Post {
  id: string
  title: string
  url: string
}

const client = new GraphQLClient({
  url: 'https://api.graph.cool/simple/v1/cjs4qo29b2w0c0130tfx6maca'
})

export const allPostsQuery = `
  query {
    allPosts(orderBy: createdAt_DESC, first: 20) {
      id
      title
      url
    }
  }
`

const createPostMutation = `
  mutation CreatePost($title: String!, $url: String!) {
    createPost(title: $title, url: $url) {

graphql-hooks

Graphql Hooks

Apache-2.0
Latest version published 4 months ago

Package Health Score

86 / 100
Full package analysis