How to use the apollo-boost.IntrospectionFragmentMatcher function in apollo-boost

To help you get started, we’ve selected a few apollo-boost 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 Liinkiing / react-typescript-apollo-starter / src / index.tsx View on Github external
import "react-hot-loader"
import React from "react"
import ReactDOM from "react-dom"
import {ApolloClient, HttpLink, IntrospectionFragmentMatcher} from "apollo-boost"
import { ApolloProvider } from "react-apollo"
import { ApolloProvider as ApolloHooksProvider } from "@apollo/react-hooks"
import introspectionQueryResultData from 'fragmentTypes.json';
// Importing both ApolloProvider from react-apollo-hooks and react-apollo
// allows to use either hooks or component in the same app
import { InMemoryCache } from "apollo-cache-inmemory"
import App from "./App"
import GlobalStyle from "./styles/global"
import * as serviceWorker from "./serviceWorker"

const fragmentMatcher = new IntrospectionFragmentMatcher({
  introspectionQueryResultData
});

const client = new ApolloClient({
  link: new HttpLink({ uri: process.env.REACT_APP_GRAPHQL_ENDPOINT || 'http://localhost:4000/graphql' }),
  cache: new InMemoryCache({ fragmentMatcher }),
})


ReactDOM.render(