Created
May 3, 2021 08:29
-
-
Save nakajo2011/da660fc7fd100e530b7613679b2db71d to your computer and use it in GitHub Desktop.
Apollo Client/Getting Started sample3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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