Skip to content

Instantly share code, notes, and snippets.

@nakajo2011
Created May 3, 2021 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nakajo2011/da660fc7fd100e530b7613679b2db71d to your computer and use it in GitHub Desktop.
Save nakajo2011/da660fc7fd100e530b7613679b2db71d to your computer and use it in GitHub Desktop.
Apollo Client/Getting Started sample3
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import fetch from 'cross-fetch';
import { gql, ApolloProvider, ApolloClient, HttpLink, InMemoryCache } from '@apollo/client';
const endpoint = 'https://48p1r2roz4.sse.codesandbox.io' // apolloのGetting Started
const client = new ApolloClient({
link: new HttpLink({ uri: endpoint, fetch }),
cache: new InMemoryCache()
});
ReactDOM.render(
<ApolloProvider client={client}>
<App />
</ApolloProvider>,
document.getElementById('root')
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment