Skip to content

Instantly share code, notes, and snippets.

@nakajo2011

nakajo2011/index.mjs

Last active May 3, 2021
Embed
What would you like to do?
Apollo Client/Getting Started sample
import fetch from 'cross-fetch';
import { gql, ApolloClient, HttpLink, InMemoryCache } from '@apollo/client';
const client = new ApolloClient({
link: new HttpLink({ uri: 'https://48p1r2roz4.sse.codesandbox.io', fetch }),
cache: new InMemoryCache()
});
client
.query({
query: gql`
query GetRates {
rates(currency: "USD") {
currency
}
}
`
})
.then(result => console.log(JSON.stringify(result, null, ' ')));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment