Connect Data-Layer to View-Layer: Introducing React Apollo

An introduction to the ApolloProvider component to connect data-layer to view-layer.

We'll cover the following

All we’ve done thus far has been the framework agnostic part of Apollo Client. However, without connecting React to it, we’d have a hard time making effective use of GraphQL. That’s why there is an official library to connect both worlds: react-apollo.

The great thing about those connecting libraries is that there are solutions for other view-layer solutions like Angular and Vue, too, so you can use the Apollo Client in a framework agnostic way.

After we have installed the library, we import ApolloProvider component from the library and use it as a composing component around our App component in the src/index.js file. Under the hood, it uses React’s Context API to pass the Apollo Client through your application.

Get hands-on with 1200+ tech skills courses.