This video is available to students only

Module 8 Summary

This lesson is a summary of the work done in Module 8.0.

In this module, we've introduced Apollo Client in our application and utilized the useQuery and useMutation Hooks available to us from the React Apollo library.

src/index.ts#

In the src/index.ts file, we create a new Apollo client with the ApolloClient constructor given to us from the apollo-boost package. apollo-boost the approach to setting up an Apollo client with a predefined configuration and setup.

The only option we specify in the ApolloClient constructor is the uri option where we define the URL endpoint of our GraphQL API. We import the <ApolloProvider> component wrapper from React Apollo and wrap our <Listings> component with <ApolloProvider>. This helps us pass the Apollo client as the client prop of ApolloProvider which provides the Apollo client in our <Listings> component as part of context.

Start a new discussion. All notification go to the author.