Complete the code to import the ApolloClient class.
import { [1] } from '@apollo/client';
The ApolloClient class is imported from '@apollo/client' to create a new client instance.
Complete the code to set the URI for the Apollo Client.
const client = new ApolloClient({ uri: '[1]' });The URI must be the full URL to the GraphQL server endpoint, usually ending with '/graphql'.
Fix the error in the code to create the Apollo Client with cache.
const client = new ApolloClient({ uri: 'http://localhost:4000/graphql', cache: new [1]() });The cache must be an instance of InMemoryCache to store query results.
Fill both blanks to import and use ApolloProvider in React.
import { ApolloClient, [1] } from '@apollo/client'; function App() { return ( <[2] client={client}> {/* Your app components */} </[2]> ); }
ApolloProvider is imported and used to wrap the React app to provide the Apollo Client instance.
Fill all three blanks to create a complete Apollo Client setup with cache and provider.
import { ApolloClient, [1], [2] } from '@apollo/client'; const client = new ApolloClient({ uri: '[3]', cache: new InMemoryCache() });
InMemoryCache and ApolloProvider are imported along with ApolloClient. The URI is set as the HttpLink string.