App
The app component takes care of importing all basic Apollo modules like ApolloClient
and ApolloProvider
.
#
ApolloClientThe Apollo Client module is initialized right in the beginning of the file like so:
This is very important since it's our only way to connect to our GraphQL server. If you're testing this locally make sure that your server is authorizing CORS calls.
#
ApolloProviderThe Apollo Provider module works as a context API for our entire app and that's why we're wrapping the App
component with it here:
This way we have access to all queries and mutations inside our components. You can find more info about those on their respective docs and how we're using hooks to access them.